Results 1 to 9 of 9

Thread: Can't declare more than 7 QStrings ?!?!?!

  1. #1
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Can't declare more than 7 QStrings ?!?!?!

    Hi all!

    I am struggling with a problem that I have never seen before. I need to declare 14 QStrings but I can only declare 7, because as soon as I declare 1 more my code crashes at the beginning.

    *** glibc detected *** /home/itadmin/workspace/LDI_SPS/LDI_SPS: double free or corruption (out): 0x08d020c0 ***
    ======= Backtrace: =========
    /lib/tls/i686/cmov/libc.so.6[0xb68a8704]
    /lib/tls/i686/cmov/libc.so.6(cfree+0x96)[0xb68aa6b6]
    /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb6a8a231]
    /usr/lib/libQtCore.so.4(_ZN6QEventD0Ev+0x47)[0xb6c293d7]
    /usr/lib/libQtCore.so.4(_ZN23QCoreApplicationPrivate16sendP ostedEventsEP7QObjectiP11QThreadData+0x2b7)[0xb6c256a7]
    /usr/lib/libQtCore.so.4(_ZN16QCoreApplication16sendPostedEv entsEP7QObjecti+0x2d)[0xb6c2588d]
    /usr/lib/libQtCore.so.4[0xb6c507ef]
    /usr/lib/libglib-2.0.so.0(g_main_context_dispatch+0x1e8)[0xb668eb88]
    /usr/lib/libglib-2.0.so.0[0xb66920eb]
    /usr/lib/libglib-2.0.so.0(g_main_context_iteration+0x68)[0xb6692268]
    /usr/lib/libQtCore.so.4(_ZN20QEventDispatcherGlib13processE ventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0 x58)[0xb6c50438]
    /usr/lib/libQtGui.so.4[0xb6efe365]
    /usr/lib/libQtCore.so.4(_ZN10QEventLoop13processEventsE6QFl agsINS_17ProcessEventsFlagEE+0x4a)[0xb6c2306a]
    /usr/lib/libQtCore.so.4(_ZN10QEventLoop4execE6QFlagsINS_17P rocessEventsFlagEE+0xea)[0xb6c234aa]
    /usr/lib/libQtCore.so.4(_ZN16QCoreApplication4execEv+0xb9)[0xb6c25959]
    /usr/lib/libQtGui.so.4(_ZN12QApplication4execEv+0x27)[0xb6e5cd17]
    /home/itadmin/workspace/LDI_SPS/LDI_SPS[0x80555e1]
    /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb684f775]
    /home/itadmin/workspace/LDI_SPS/LDI_SPS[0x804bbb1]
    ======= Memory map: ========
    08048000-08062000 r-xp 00000000 08:01 1843375 /home/itadmin/workspace/LDI_SPS/LDI_SPS
    08062000-08063000 r--p 00019000 08:01 1843375 /home/itadmin/workspace/LDI_SPS/LDI_SPS
    08063000-08064000 rw-p 0001a000 08:01 1843375 /home/itadmin/workspace/LDI_SPS/LDI_SPS
    08b48000-08e49000 rw-p 08b48000 00:00 0 [heap]
    b4400000-b4421000 rw-p b4400000 00:00 0
    b4421000-b4500000 ---p b4421000 00:00 0
    b45ed000-b46c8000 r-xp 00000000 08:01 7634980 /opt/indel/lib/libwx_basei-2.6.so.0.2.0
    .....................
    This is how the header file looks like:

    Qt Code:
    1. /*
    2.  * ModuleTracer.h
    3.  *
    4.  * Created on: Jul 20, 2010
    5.  * Author: itadmin
    6.  */
    7.  
    8. #ifndef MODULETRACER_H_
    9. #define MODULETRACER_H_
    10.  
    11. #include "SPS/SPS_Indel_lib.h"
    12. #include "Gui-Adds/modules_start.h"
    13.  
    14. #include <QThread>
    15. #include <QtCore>
    16.  
    17.  
    18. class ModuleTracer : public QThread {
    19. Q_OBJECT
    20. public:
    21. ModuleTracer();
    22. virtual ~ModuleTracer();
    23. void run();
    24.  
    25.  
    26. SPS_Indel_lib *indel_lib_Class;
    27.  
    28.  
    29. QString module_LoadUnit_X_Axis_Value,
    30. module_LoadUnit_Cyl_Axis_Value,
    31. module_ChuckUnitPortal_Value,
    32. module_ChuckUnitSupport_Value,
    33. module_ChuckUnitVacuum_Value,
    34. module_ToolUnitHexpod_Value,
    35. module_ToolUnitVacuumInside_Value;
    36. // module_ToolUnitVacuumOutside_Value;
    37. // module_ImagingUnitHead1_Z_Axis_Value,
    38. // module_ImagingUnitHead1_CAM_Value,
    39. // module_ImagingUnitHead2_Z_Axis_Value,
    40. // module_ImagingUnitHead2_CAM_Value,
    41. // module_Utilities_Value,
    42. // module_Airpressure_Value;
    43.  
    44. const char* _Target;
    45.  
    46. Modules_Start *Modules_Window;
    47.  
    48. };
    49.  
    50. #endif /* MODULETRACER_H_ */
    To copy to clipboard, switch view to plain text mode 

    As you can see some of my QStrings are commented because I can't run the program if they aren't.

    If it helps I am using Eclipse Helios with qt 4.5.0 on ubuntu 9.04 32 bits.

    Thanks

  2. #2
    Join Date
    Nov 2007
    Posts
    55
    Thanks
    1
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't declare more than 7 QStrings ?!?!?!

    look at your delimiters in your string list... you have some ";" instead of ","

  3. #3
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't declare more than 7 QStrings ?!?!?!

    Quote Originally Posted by alainstgt View Post
    look at your delimiters in your string list... you have some ";" instead of ","
    if that was the problem the program would not even run.
    I just have some with ; and other with , because that's where I stop to test

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't declare more than 7 QStrings ?!?!?!

    Why are you subclassing QThread? Inherit QObject instead and create a normal QThread object.

  5. #5
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't declare more than 7 QStrings ?!?!?!

    I got it woking but I still don't know why I got the errors. It works with the class inherited from the QThread

  6. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can't declare more than 7 QStrings ?!?!?!

    There is some memory corruption problem.
    Check for instances where you are creating and deleting the objects of your class.

  7. #7
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't declare more than 7 QStrings ?!?!?!

    but now it works...I wish it didn't so I could see why. I have no idea why it works now

    I also don't think it was a problem with a delete because I had none

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Can't declare more than 7 QStrings ?!?!?!

    You probably didn't recompile part of your project after adding strings and the size of your object changed enough to change relocation offsets of some method, hence the crash.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't declare more than 7 QStrings ?!?!?!

    That seams possible to me

Similar Threads

  1. Quick QString question: Using " characters in QStrings
    By JPNaude in forum Qt Programming
    Replies: 2
    Last Post: 6th March 2009, 07:30
  2. concatenating path QStrings
    By rbp in forum Qt Programming
    Replies: 2
    Last Post: 19th December 2008, 04:46
  3. QSettings on QStrings
    By OriginalCopy in forum Qt Programming
    Replies: 4
    Last Post: 4th November 2007, 10:57
  4. dynamic matrix of QStrings
    By QiT in forum Newbie
    Replies: 19
    Last Post: 4th April 2007, 09:26
  5. declare in designer
    By mickey in forum Newbie
    Replies: 1
    Last Post: 23rd February 2006, 19:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.