Re: QThread crashes on exit
now see... thousands of ppl use QThread everyday.. if it was so easy to crash it than it would have been found and fixed there and then... so the problem is in your case..
whenever your proggi crashes in Qt code, then make a minimal compilable example that would reproduce the bug and submit it to trolltech... it would also be helpful to answer you if you submit it here ...
Re: QThread crashes on exit
Re: QThread crashes on exit
Aren't you calling exit() on an uninitialized QThread pointer by any chance?
Re: QThread crashes on exit
There is no core dump. How do you enable that again? I'm using RedHat if that matters.
In this case the threads are declared as member variables on the stack, so the threads can't be uninitialized pointers. I suppose there could be other uninitialized pointers ...
I realize there are a lot of people who use QThreads all the time, but I don't think a large portion of the herd is running in my direction (lots of threads containing networking classes). The other thing is I wonder how a private Qt-class variable is not initialized ...
Re: QThread crashes on exit
Quote:
Originally Posted by
mhoover
In this case the threads are declared as member variables on the stack, so the threads can't be uninitialized pointers.
Sure they can.
Quote:
The other thing is I wonder how a private Qt-class variable is not initialized ...
Probably because it was deleted or has not been initialized yet. Or... you have stack corruption.
Re: QThread crashes on exit
Thanks again, everyone for your help.
This solved the problem:
Code:
UDPThread::~UDPThread()
{
exit();
while( this->isRunning() == true ) {
}
}
My assumption was exit() didn't return until the thread was finished running, but it keeps going.
It looks like exit() stops the event loop and then stops the run() a bit later.
Re: QThread crashes on exit
try to use "native" methods of QThread
Code:
UDPThread::~UDPThread()
{
if (isRunning()) {
quit();
wait();
}
}
Re: QThread crashes on exit
Oh, right.
I was trying to use the intellisense thing to quickly see what methods were available.
I will change it.