Problem with a crash on exit.
-
I'm using Linux (CentOS 5.8 and Mint 13) with Qt 4.7.1 and I'm seeing a crash on exit with my app. It's not a very consistent crash, sometimes there's no crash, sometimes it's in different locations. However, it seems to pretty consistently crash in some sort of QGlobalStaticDeleter (bottom of the stack trace is in malloc_consolidate). Often, it's in the deleter for QPMCache.
My app uses DSO plugins (not Qt plug-ins, a custom solution) and I've already checked for static linkage to Qt mixed with dynamic. (I don't have any static qt libs on my system so I couldn't be linking to them). I can't reproduce with a simple app but the app is open source so I can point folks at source code if they need to see it.
I have managed to narrow down the crash so that it only happens with two plugins installed, both of which create QWidgets and toolbar items with pixmaps. It appears as if the destructors are being called before unloading the DSO so that doesn't seem to be the problem. I'm running out of ideas...any suggestions on how to proceed debugging this? Below is a sample backtrace.
#0 0x00007ffff22998b0 in malloc_consolidate (av=0x7ffff25d1720) at malloc.c:4246
#1 0x00007ffff229a5a9 in malloc_consolidate (av=0x7ffff25d1720) at malloc.c:4215
#2 _int_free (av=0x7ffff25d1720, p=<optimized out>, have_lock=0) at malloc.c:4146
#3 0x00007ffff59fa552 in qFree (ptr=0x2213d20) at global/qmalloc.cpp:60
#4 0x00007ffff5a54d86 in QString::free (d=0x2213d20) at tools/qstring.cpp:1185
#5 0x00007ffff4b8ba71 in QString::~QString (this=0x202f830, __in_chrg=<optimized out>)
at ../../include/QtCore/../../src/corelib/tools/qstring.h:883
#6 0x00007ffff4cadc49 in QHashNode<QString, QPixmapCache::Key>::~QHashNode (this=0x202f820,
__in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qhash.h:216
#7 0x00007ffff4cadc8e in QHash<QString, QPixmapCache::Key>::deleteNode2 (node=0x202f820)
at ../../include/QtCore/../../src/corelib/tools/qhash.h:519
#8 0x00007ffff5a244c7 in QHashData::free_helper (this=0x1d25ab0,
node_delete=0x7ffff4cadc6e <QHash<QString, QPixmapCache::Key>::deleteNode2(QHashData::Node*)>)
at tools/qhash.cpp:271
#9 0x00007ffff4caceed in QHash<QString, QPixmapCache::Key>::freeData (this=0x1d02660, x=0x1d25ab0)
at ../../include/QtCore/../../src/corelib/tools/qhash.h:568
#10 0x00007ffff4cac208 in QHash<QString, QPixmapCache::Key>::~QHash (this=0x1d02660,
__in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qhash.h:284
#11 0x00007ffff4caac31 in QPMCache::~QPMCache (this=0x1d02610, __in_chrg=<optimized out>)
at image/qpixmapcache.cpp:227
#12 0x00007ffff4caacca in QPMCache::~QPMCache (this=0x1d02610, __in_chrg=<optimized out>)
at image/qpixmapcache.cpp:231
#13 0x00007ffff4cace0b in QGlobalStaticDeleter<QPMCache>::~QGlobalStaticDeleter (this=0x7ffff59682d8,
__in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/global/qglobal.h:1820
#14 0x00007ffff2256921 in __run_exit_handlers (status=0, listp=0x7ffff25d1688, run_list_atexit=true)
at exit.c:78
#15 0x00007ffff22569a5 in __GI_exit (status=<optimized out>) at exit.c:100
#16 0x00007ffff223c774 in __libc_start_main (main=0xb9dd04 <main(int, char**)>, argc=1,
ubp_av=0x7fffffffea78, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7fffffffea68) at libc-start.c:258
#17 0x0000000000b9dc49 in _start () -
"Valgrind?":http://valgrind.org/