PDA

View Full Version : Can't declare more than 7 QStrings ?!?!?!



ruben.rodrigues
21st July 2010, 09:59
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:


/*
* ModuleTracer.h
*
* Created on: Jul 20, 2010
* Author: itadmin
*/

#ifndef MODULETRACER_H_
#define MODULETRACER_H_

#include "SPS/SPS_Indel_lib.h"
#include "Gui-Adds/modules_start.h"

#include <QThread>
#include <QtCore>


class ModuleTracer : public QThread {
Q_OBJECT
public:
ModuleTracer();
virtual ~ModuleTracer();
void run();


SPS_Indel_lib *indel_lib_Class;


QString module_LoadUnit_X_Axis_Value,
module_LoadUnit_Cyl_Axis_Value,
module_ChuckUnitPortal_Value,
module_ChuckUnitSupport_Value,
module_ChuckUnitVacuum_Value,
module_ToolUnitHexpod_Value,
module_ToolUnitVacuumInside_Value;
// module_ToolUnitVacuumOutside_Value;
// module_ImagingUnitHead1_Z_Axis_Value,
// module_ImagingUnitHead1_CAM_Value,
// module_ImagingUnitHead2_Z_Axis_Value,
// module_ImagingUnitHead2_CAM_Value,
// module_Utilities_Value,
// module_Airpressure_Value;

const char* _Target;

Modules_Start *Modules_Window;

};

#endif /* MODULETRACER_H_ */


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

alainstgt
21st July 2010, 11:12
look at your delimiters in your string list... you have some ";" instead of ","

ruben.rodrigues
21st July 2010, 12:41
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

squidge
21st July 2010, 13:17
Why are you subclassing QThread? Inherit QObject instead and create a normal QThread object.

ruben.rodrigues
21st July 2010, 13:29
I got it woking but I still don't know why I got the errors. It works with the class inherited from the QThread

aamer4yu
21st July 2010, 13:30
There is some memory corruption problem.
Check for instances where you are creating and deleting the objects of your class.

ruben.rodrigues
21st July 2010, 13:41
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

wysota
21st July 2010, 13:56
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.

ruben.rodrigues
21st July 2010, 14:42
That seams possible to me