PDA

View Full Version : segmentation fault



shamik
23rd November 2006, 11:13
hiiii friends

i am getting segmentation fault everytime i try to create a thread. the thread gets executed but then immediately segmentation fault occurs.
i am not quite sure that my Qt 3.3.0 is configure with multi threading support or not.
but i think it supports multithreading because the library files in qt are libqt-mt.so(link), libqt-mt.so.3(link) , libqt-mt.so.3 .3(link) , libqt-mt.so.3.3.0 .

but i am not using the threads of Qt. Actually the project file is made and compiled in Qt using qmake.
but then i have included the dialogs in kdevelop. and then i use the kdevelop's thread i.e. i include the header file pthread.h
and then create the thread using pthread_create() function which is of kdevelop and not Qt.

then also the segmentation fault occurs.

do you think it is necessary to enable multi threading in Qt to use multithreading in kdevelop??


thanks and regards

shamik

sudeepdua
23rd November 2006, 14:42
are u sure its because of the multithreading when done in your program...

shamik
24th November 2006, 05:48
now i am quite sure that my Qt is multithreaded

previously before including threading in my program it was working fine. but to provide more functionality i have to include threads.
and when i started including threads, everytime the program executed, it terminated unusually causing segmentation fault.

i think its because the function in which i m creating the thread is getting finished so the thread also has to get terminated.
but i dont know the exact reason.

please tell me how to do multi threading. as i told i am using pthread. is this pthread.h class is contained in our traditional c++ ??

regards
shamik

quickNitin
24th November 2006, 08:33
No, pthread library is not part of C++. and you can well use pthread library with Qt.

i think its because the function in which i m creating the thread is getting finished so the thread also has to get terminated.
but i dont know the exact reason.

Simple deletion of object will also produce warning thread object deleted while in use . You may be refrencing to a object either not created or deleted during execution.