Solved Qt4 application crashes when running in KDE session


I'm having a strange problem here, my own Qt4 tool crashes and obviously doesn't even reach my application code only when running inside my KDE session -- it works fine when started over ssh -X from another machine. Looks like this:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 806415000 (LWP 100238/shuttercontrol)]
0x0000000804a9f428 in vtable for __cxxabiv1::__si_class_type_info ()
   from /lib/
Current language:  auto; currently minimal
(gdb) bt
#0  0x0000000804a9f428 in vtable for __cxxabiv1::__si_class_type_info ()
   from /lib/
#1  0x0000000805e8ace1 in __dynamic_cast ()
   from /usr/local/lib/compat/
#2  0x000000080b8bf264 in KConfigGroup::reparent ()
   from /usr/local/lib/
#3  0x000000080b8b8bf6 in KConfigGroup::KConfigGroup ()
   from /usr/local/lib/
#4  0x000000080b98097e in KStandardDirs::addCustomized ()
   from /usr/local/lib/
#5  0x000000080b9749ff in KComponentData::KComponentData ()
   from /usr/local/lib/
#6  0x000000080b97482b in KComponentData::KComponentData ()
   from /usr/local/lib/
#7  0x000000080b974423 in KGlobal::findDirectChild_helper ()
   from /usr/local/lib/
#8  0x000000080b973346 in KGlobal::dirs () from /usr/local/lib/
#9  0x000000080b973410 in KGlobal::config ()
   from /usr/local/lib/
#10 0x0000000809f5026e in qt_plugin_instance ()
   from /usr/local/lib/kde4/plugins/gui_platform/
#11 0x0000000800c7309f in QApplicationPrivate::x11_apply_settings ()
   from /usr/local/lib/qt4/
#12 0x0000000800c7a4a0 in QApplicationPrivate::reset_instance_pointer ()
   from /usr/local/lib/qt4/
#13 0x0000000800c78377 in QApplicationPrivate::reset_instance_pointer ()
---Type <return> to continue, or q <return> to quit---
   from /usr/local/lib/qt4/
#14 0x0000000800c05701 in QApplicationPrivate::construct ()
   from /usr/local/lib/qt4/
#15 0x0000000800c058b5 in QApplication::QApplication ()
   from /usr/local/lib/qt4/
#16 0x0000000000405d43 in ?? ()
#17 0x00007fffffffe590 in ?? ()
#18 0x000000010065c000 in ?? ()
#19 0x00007fffffffe418 in ?? ()
#20 0x00007fffffffe4c0 in ?? ()
#21 0x00007fffffffe588 in ?? ()
#22 0x00007fffffffe5a0 in ?? ()
#23 0x0000000000000660 in ?? ()
#24 0x0000000800858790 in list_global () from /libexec/
#25 0x000000000000037f in ?? ()
#26 0x0000000000000000 in ?? ()
Any ideas what's wrong here? I don't really think it's my code cause it worked very well on Linux and Windows, but just in case....

Of course next thing I'll try is to reproduce this with minimal Qt4 applications, but maybe someone around here just knows what's going on :)
Ok, I found the culprit: my tool was setting the default compiler with CXX:= g++, which is only overridable from the command line, not from the environment. Changing it to CXX?= g++ made it build with clang++ and the crash with /usr/local/lib/kde4/plugins/gui_platform/ was gone. So it was just binary incompatibility of different C++ compilers, I probably should have known that...