PDA

View Full Version : Calling Recursivly loading function in Run() method of QThread



santosh.kumar
15th May 2007, 14:19
hi

I m using recursivly loading directory method in Run() function of QThread.
i m giving definiton of this method in other class and displaying in treeWidget.
when i m calling this method using object of this class in Run() method it becomes crashed...

void class::Run()
{
otherclass *obj;
while(!bFalse)
{
obj->method(QString path);
}
}
here while loop is better or if else.

can u give me suggestions that why this happens..can I use Gui classes in QThread or not...

high_flyer
15th May 2007, 14:28
well, to start with, in the code above 'obj' is not initialized, and that alone would make it crash.

marcel
15th May 2007, 14:42
Do not modify the GUI from another thread. This must be done only by the GUI thread.
Instead of what you do, notify the GUI thread( via signals ) and let it update the widgets.