05-29-2012 02:41 PM
Here is my code,
void AlertListPage::onOnCallClicked()
{
thread = new DownLoadThread();
QThreadPool *pool = new QThreadPool();
pool->start(thread,0);
}
class DownLoadThread: public QObject, public QRunnable {
Q_OBJECT
public:
DownLoadThread();
virtual ~DownLoadThread();
virtual void run();
...
...
}
cpp...
DownLoadThread::DownLoadThread() {
// TODO Auto-generated constructor stub
}
DownLoadThread::~DownLoadThread() {
// TODO Auto-generated destructor stub
sta::out<<"test";
}
void DownLoadThread::run()
{
...
...
}
I have set breakpoint at line:
pool->
start(thread,0);
and first line within Run() method.
once execute poo->start, and before going to run, it will throws can not access memory at address 0x0,
I can not see where i set Object as null...
Thanks.
Solved! Go to Solution.
05-29-2012 04:42 PM
Do you need a Threadpool and QRunnable? You could also use QThread -> http://qt-project.org/doc/qt-4.8/QThread.html
Do you initialize QObject in constructor? It doesn't look so, cause your Constructor doesn't need a QObject as parent. So maybe parent is NULL.
05-30-2012 02:18 PM
Hi BikeAtor,
Thanks for your quick hint.
yes, you are right, QObject was not initlized and that cause problem.