PDA

View Full Version : Problems with QThreads



reinki0013
24th September 2012, 12:52
Hello,

we are developing an application in a virtual-vm-ware on linux/debian. when i debug the application on the virtual-vm-ware it works really good an nothing bad happens.

but when i compile the programm (arm-linux-gnueabi-g++) there are very strange problems now.

here is the last problem what i got, when i debug on the device with gdb:



Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x4178a460 (LWP 534)]
0x4015dd7c in QNetworkInterface::QNetworkInterface(QNetworkInter face const&) ()
from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtNetwork.so.4
(gdb) bt
#0 0x4015dd7c in QNetworkInterface::QNetworkInterface(QNetworkInter face const&) ()
from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtNetwork.so.4
#1 0x0003a350 in cNetworkThread::run() ()
#2 0x40222b90 in ?? () from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtCore.so.4
#3 0x40222b90 in ?? () from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtCore.so.4
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) info frame
Stack level 0, frame at 0x41789c48:
pc = 0x4015dd7c in QNetworkInterface::QNetworkInterface(QNetworkInter face const&);
saved pc 0x3a350
called by frame at 0x41789ca8
Arglist at 0x41789c38, args:
Locals at 0x41789c38, Previous frame's sp is 0x41789c48
Saved registers:
r4 at 0x41789c38, r5 at 0x41789c3c, r6 at 0x41789c40, lr at 0x41789c44
(gdb) info stack
#0 0x4015dd7c in QNetworkInterface::QNetworkInterface(QNetworkInter face const&) ()
from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtNetwork.so.4
#1 0x0003a350 in cNetworkThread::run() ()
#2 0x40222b90 in ?? () from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtCore.so.4
#3 0x40222b90 in ?? () from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtCore.so.4
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) info bt
Undefined info command: "bt". Try "help info".
(gdb) bt
#0 0x4015dd7c in QNetworkInterface::QNetworkInterface(QNetworkInter face const&) ()
from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtNetwork.so.4
#1 0x0003a350 in cNetworkThread::run() ()
#2 0x40222b90 in ?? () from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtCore.so.4
#3 0x40222b90 in ?? () from /usr/local/packages/qt-armel-qvfb-4.7.1/lib/libQtCore.so.4
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Here is my cNetworkThread.h:



class cNetworkThread : public QThread
{
Q_OBJECT

public:

explicit cNetworkThread(QObject *parent = 0);
void run();

};


and here is my .cpp:



cNetworkThread::cNetworkThread(QObject *parent) :
QThread(parent)
{
qDebug() << "Network-Thread Konstruktor";
qDebug() << "Network-Thread ID" << currentThreadId();
}

void cNetworkThread::run()
{
qDebug() << "Network-Thread run-Methode" << currentThreadId();
while(true)
{
msleep(200);
QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();

for(int i = 0; i < ifaces.count(); i++)
{
msleep(200);
QNetworkInterface iface = ifaces.at(i);
QString interfaceName = ifaces[i].name();
if(interfaceName == "eth0")
{
if(iface.flags().testFlag(QNetworkInterface::IsRun ning) && !iface.flags().testFlag(QNetworkInterface::IsLoopB ack))
{
// Connection still running
}
else
{
// Connection down
cLedState::SetLED(LED_NETWORK);
}
}
}
ifaces.clear();
}
}

do you have any idea what is going wrong?

i do also have some problems with "qt glibc detected corrupted double-linked list".

i hope you can help me with my problem!
attached you find my complete project!

kind regards

wysota
24th September 2012, 15:49
Is cLedState::setLED() in any way related to GUI?

reinki0013
25th September 2012, 05:54
Is cLedState::setLED() in any way related to GUI?

We don`t have a GUI - the program loads data that we get from the CAN-Bus into a MySQL-Database.
With cLedState::setLED() we can set the LED from the device in any case of error.

wysota
25th September 2012, 09:22
The backtrace suggests you have a corrupt stack. This can happen either if you overwrite it yourself or if you have incompatible set of libraries.

What do you have in your program apart this thread?

reinki0013
25th September 2012, 09:42
The backtrace suggests you have a corrupt stack. This can happen either if you overwrite it yourself or if you have incompatible set of libraries.

What do you have in your program apart this thread?

what do you mean with what i have apart in this thread?

wysota
25th September 2012, 10:01
Your program probably consists of something more than only a class inheriting QThread. The problem might be there and that's why I'm asking.

reinki0013
25th September 2012, 12:36
Your program probably consists of something more than only a class inheriting QThread. The problem might be there and that's why I'm asking.

in our virtual-vm (64bit) runs the application without any problem - on the device we have the problems