[Development] QTBUG-48709: calling ::exit() may crash

Thiago Macieira thiago.macieira at intel.com
Tue Oct 20 17:56:33 CEST 2015


...because the application will unload the libraries while other threads are 
still running code from those threads. In the bug report, the crash happens 
because of the QXcbEventReader thread, but it could have been any other thread 
we start or any other library starts.

Can anyone think of a solution to this problem?

The most immediate answer doesn't work: using a static destructor in the 
library to stop the threads it knows it started. That falls apart because it 
may not have a list of threads it started. More importantly, if it's run 
during library unloading, other required libraries may already have been 
unloaded. What's worse, the act of trying to cleanly exit the thread could 
cause it to call functions that have been unloaded.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list