Bug 147036 - KGlobalAccel dtor crashes during application shutdown.
Summary: KGlobalAccel dtor crashes during application shutdown.
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-21 15:26 UTC by whirm
Modified: 2009-05-21 16:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fix crash by unloading KGlobalAccel prior to GUI shutdown. (2.25 KB, patch)
2007-06-24 07:08 UTC, Michael Pyne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description whirm 2007-06-21 15:26:59 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc version 4.1.3 20070601 (prerelease) (Debian 4.1.2-12)
 
OS:                Linux

Using current trunk svn build in debian unstable amd64.

I found several closed bugs, but all from older versions.

BackTrace Follows:

Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 47869499794832 (LWP 17335)]
[KCrash handler]
#4  0x000000381528ed20 in XKeysymToKeycode () from /usr/lib/libX11.so.6
#5  0x00002b897927aa7e in KKeyServer::getModsRequired (sym=65470)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/util/kkeyserver_x11.cpp:402
#6  0x00002b897927af06 in KKeyServer::keyQtToCodeX (keyQt=150994992, 
    keyCode=0x7fff331c0dbc)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/util/kkeyserver_x11.cpp:428
#7  0x00002b8979279f2f in KGlobalAccelImpl::grabKey (this=0x692af0, 
    keyQt=150994992, grab=false)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/shortcuts/kglobalaccel_x11.cpp:93
#8  0x00002b89791c8930 in KGlobalAccel::changeGrab (this=0x691530, 
    action=0x68d310, newGrab=@0x7fff331c1060)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/shortcuts/kglobalaccel.cpp:376
#9  0x00002b89791c8bdb in KGlobalAccel::enableAction (this=0x691530, 
    action=0x68d310, enable=false)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/shortcuts/kglobalaccel.cpp:313
#10 0x00002b89791c8c90 in KGlobalAccel::updateGlobalShortcutAllowed (
    this=0x691530, action=0x68d310)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/shortcuts/kglobalaccel.cpp:337
#11 0x00002b89790f47ad in ~KAction (this=0x68d310)
    at /home/whirm/src/kde4/src/KDE/kdelibs/kdeui/actions/kaction.cpp:98
#12 0x00002b897ba2a4bb in QObjectPrivate::deleteChildren (this=0x68e5e0)
    at kernel/qobject.cpp:1913
#13 0x00002b897ba30d01 in ~QObject (this=0x6be320) at 
kernel/qobject.cpp:811
#14 0x00002b89790f02d0 in ~KActionCollection (this=0x6be320)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/actions/kactioncollection.cpp:113
#15 0x00002b897ba2a4bb in QObjectPrivate::deleteChildren (this=0x61a960)
    at kernel/qobject.cpp:1913
#16 0x00002b897ba30d01 in ~QObject (this=0x7fff331c13d0)
    at kernel/qobject.cpp:811
#17 0x00002b897ba1e19f in ~QCoreApplication (this=0x7fff331c13d0)
    at kernel/qcoreapplication.cpp:464
#18 0x00002b897afe8095 in ~QApplication (this=0x7fff331c13d0)
    at kernel/qapplication.cpp:982
#19 0x00002b897919d25b in ~KApplication (this=0x7fff331c13d0)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:900
#20 0x00002b89791a44e4 in ~KUniqueApplication (this=0x7fff331c13d0)
    at 
/home/whirm/src/kde4/src/KDE/kdelibs/kdeui/kernel/kuniqueapplication.cpp:314
#21 0x00002b8977953d03 in ~Kicker (this=0x7fff331c13d0)
    at 
/home/whirm/src/kde4/src/KDE/kdebase/workspace/kicker/kicker/core/kicker.cpp:138
#22 0x00002b8977953428 in kdemain (argc=1, argv=0x7fff331c16f8)
    at 
/home/whirm/src/kde4/src/KDE/kdebase/workspace/kicker/kicker/core/main.cpp:165
#23 0x0000000000400983 in main (argc=1, argv=0x7fff331c16f8)
    at 
/home/whirm/src/kde4/build/KDE/kdebase/workspace/kicker/kicker/kicker_dummy.cpp:3
#0  0x00000032dc80dc25 in waitpid () from /lib/libpthread.so.0



Regards!
Comment 1 Michael Pyne 2007-06-24 05:22:01 UTC
I can confirm this bug, with a slightly different backtrace from JuK (which uses KGlobalAccel extensively).

The problem appears to be that QX11Info::display() (called at kdeui/util/kkeyserver_x11.cpp:402) returns 0 during the shutdown sequence for an application.  This causes libX11 to crash.
Comment 2 Michael Pyne 2007-06-24 05:24:45 UTC
Sorry about the noise, I forgot to adjust the bug summary.
Comment 3 Michael Pyne 2007-06-24 05:38:16 UTC
The "obvious" fix of caching the value of QX11Info::display() does not work.  Presumably the GUI interface has been brought down by this point.  KGlobalAccel probably needs to be manually destructed in e.g. KApplication.
Comment 4 Michael Pyne 2007-06-24 07:08:35 UTC
Created attachment 20940 [details]
Fix crash by unloading KGlobalAccel prior to GUI shutdown.

Proposed patch to fix the bug.	Fixes the JuK crash at least.  It is a simple
patch but it involves adding a function to KApplication to allow programs (and
other parts of KDE) to add cleanup functions to be called in the KApplication
dtor before the GUI is unloaded.

This way applications do not have to manually unload KGlobalAccel (and no hack
has to be added to KGlobalAccel to expose the singleton's destroy method).
Comment 5 Michael Jansen 2009-05-21 16:22:45 UTC
I think we can close this one as it is fairly old and most likely fixed.

Reopen if you disagree.