Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700
Accepted Solution

Cannot access memory at address 0x0 when starting thread to build connection...

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.

 

Developer
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook
My Carrier: None

Re: Cannot access memory at address 0x0 when starting thread to build connection...

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.

Highlighted
Developer
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: Cannot access memory at address 0x0 when starting thread to build connection...

Hi BikeAtor,

 

Thanks for your quick hint.

 

yes, you are right, QObject was not initlized and that cause problem.