-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
3.x
-
None
It's possible to have dependency between global static objects in qt,
and if one is used from others destructor, depending on the destruction order, the application can segfault on exit.
Here is the example which triggers this bug with QPluginLoader and qrand().
QPluginLoaded saves plugins cache with QSettings in destructor of internal global static object
(which calls QMap::insert() and qrand() for large enough maps):
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QPluginLoader loader("./libphononengine.so");
loader.load();
qrand();
return 0;
}
The second example (attached) triggers the same bug, but it is easier to reproduce (doesn't require library and large enough settings file).
The bug can be reproduced on linux and mac, where qrand() uses global static seeds storage,
but is also possible with other combinations of global static objects.