[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ShopSuite-dev] QThread C++
From: |
Davi Leal |
Subject: |
[ShopSuite-dev] QThread C++ |
Date: |
Sun, 7 Apr 2002 15:22:23 +0200 |
I have a QThread + QApplication 'main()' which crash 40% times. The output of
the crash is:
$ ./shopsuite
Connected to the data base: shop
Listening products: shop
pure virtual method called <----
Aborted <----
$
See below. If I uncomment the poolDB.wait() line the application never crash,
however only when the QThread finish the application follows executing up to
the "return app.exec()" event loop.
Maybe, is it due to I use the QApplication object. Must I convert the
QApplication process into a second QThread to avoid the crash?. Any idea?.
int main(int argc, char* argv[])
{
QApplication app( argc, argv );
[...]
PoolDB poolDB;
poolDB.start();
/* poolDB.wait(); COMMENTED <------------*/
break; // Go out to the normal event loop 'app.exec()'
}
}
return app.exec();
}
---
Qt 2.3.1
ii libqt2 2.3.1-22 Qt GUI Library (runtime version).
ii libqt2-mt 2.3.1-22 Qt GUI Library (runtime threaded
version).
Postgres 7.2.1
c++ -DQT_THREAD_SUPPORT
c++ -Wall -g -O2 -lqt-mt
Debian GNU/Linux 'sid'
--
The below example from Qt 2.3 doc works rightly:
#include <qapplication.h>
#include <qthread.h>
class MyThread : public QThread {
public:
virtual void run();
};
void MyThread::run()
{
for(int count=0;count<20;count++) {
sleep(1);
qDebug("Ping!");
}
}
int main()
{
MyThread a;
MyThread b;
a.start();
b.start();
a.wait();
b.wait();
}
g++ -DQT_THREAD_SUPPORT -Wall -O2 -o test test.cpp -I/usr/include/qt/ -lqt-mt
- [ShopSuite-dev] QThread C++,
Davi Leal <=