Always use initializer lists. On 6 Dec 2009, at 13:39, Gilles Valette wrote:
> Message de Soumen banerjee <[email protected]>: > >> In the files attached, mainwindow.cpp has the following line >> >> connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int))); >> >> where ptr is of type mythread* which is derived from QThread >> the application compiles without error but on running, quits with >> segfault. Omitting the connect line solves the problem but removes all >> the functionality. How do you connect these together? >> Regards >> Soumen >> > > Hi, > > In mainwindow.cpp when you call connect, ptr is undefined, causing the > segfault. > > Putting the two lines in this order solves the problem : > > ptr=new mythread(this); > connect(ptr,SIGNAL(setlabel(int)),this,SLOT(setLabel(int))); > > Hope this helps. > > Gilles > > > _______________________________________________ > Qt-creator mailing list > [email protected] > http://lists.trolltech.com/mailman/listinfo/qt-creator _______________________________________________ Qt-creator mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-creator
