Comment 59 for bug 864975

Revision history for this message
In , Petr Běhan (huancz) wrote :

I have been plagued for a few months by this problem, or at least a problem with the same symptoms: ktimetracker pops modal dialog saying "could not create ktimetrackerpart" and then opens empty window. For me, it's 100% correlated with compiler used. I first noticed it after upgrading to gcc-4.7-alpha, and it's been that way ever since. If I rebuild my system (gentoo x86_64) using gcc-4.7.anything, ktt is broken. If I then switch compiler to 4.6.3 and rebuild ktimetracker package, it works again (rest of system can stay built with 4.7).

Here is my attempt to poke at it a bit with gdb, but without any real QT knowledge, I have no idea what to try next:

KTimeTracker compiled with gcc-4.7.2_pre9999 (snapshot of gcc-4_7-branch from Sat Aug 4 00:17:53, but been the same since 4.7.0 release):
(gdb) frame
#0 qobject_cast<ktimetrackerpart*> (object=0x5b5360) at /usr/include/qt4/QtCore/qobject.h:380
380 return static_cast<T>(reinterpret_cast<T>(object)->staticMetaObject.cast(object));
(gdb) bt
#0 qobject_cast<ktimetrackerpart*> (object=0x5b5360) at /usr/include/qt4/QtCore/qobject.h:380
#1 0x000000000043eff6 in KPluginFactory::create<ktimetrackerpart> (this=0x523310, parent=0x652b00, args=...) at /usr/include/kpluginfactory.h:509
#2 0x000000000043da02 in MainWindow::MainWindow (this=0x652b00, icsfile=..., __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
    at /usr/src/debug/kde-base/ktimetracker-4.9.0/ktimetracker-4.9.0/ktimetracker/mainwindow.cpp:68
#3 0x0000000000422adc in main (argc=1, argv=0x7fffffffd868) at /usr/src/debug/kde-base/ktimetracker-4.9.0/ktimetracker-4.9.0/ktimetracker/main.cpp:128
(gdb) print reinterpret_cast<T>(object)
$15 = (ktimetrackerpart *) 0x5b5360
(gdb) print reinterpret_cast<T>(object)->staticMetaObject.cast(object)
$16 = (QObject *) 0x0 <====== This 0x0 is then returned and causes message box to appear.

Similar session when compiled with 4.6.3:
(gdb) bt
#0 qobject_cast<ktimetrackerpart*> (object=0x555000) at /usr/include/qt4/QtCore/qobject.h:380
#1 0x000000000043f3b8 in KPluginFactory::create<ktimetrackerpart> (this=0x54c910, parent=0x671d20, args=...) at /usr/include/kpluginfactory.h:509
#2 0x000000000043de27 in MainWindow::MainWindow (this=0x671d20, icsfile=..., __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
    at /usr/src/debug/kde-base/ktimetracker-4.9.0/ktimetracker-4.9.0/ktimetracker/mainwindow.cpp:68
#3 0x00000000004230ce in main (argc=1, argv=0x7fffffffd868) at /usr/src/debug/kde-base/ktimetracker-4.9.0/ktimetracker-4.9.0/ktimetracker/main.cpp:128
(gdb) print reinterpret_cast<T>(object)
$17 = (ktimetrackerpart *) 0x555000
(gdb) print reinterpret_cast<T>(object)->staticMetaObject.cast(object)
$18 = (QObject *) 0x555000 <====== now it works

CXXFLAGS=-O0 -ggdb
-Bsymbolic-function mentioned earlier is not enabled