Bug 171379 - KDE Daemon (kded4), signal SIGSEGV
Summary: KDE Daemon (kded4), signal SIGSEGV
Status: CLOSED FIXED
Alias: None
Product: khotkeys
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Lubos Lunak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-20 13:39 UTC by Stefan Usenbinz
Modified: 2008-11-20 00:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Usenbinz 2008-09-20 13:39:36 UTC
Version:            (using Devel)
Compiler:          gcc-Version 4.2.4 (Ubuntu 4.2.4-1ubuntu1) 
OS:                Linux
Installed from:    Compiled sources

Follow on to bug 171378. After Plasma crashed and restarted kded4 crashed on logout.

System is Kubuntu 8.04 x86_64.

KDE is compiled from SVN. SVN revisions:
URL: svn://anonsvn.kde.org/home/kde/trunk/qt-copy
Revision: 862874
URL: svn://anonsvn.kde.org/home/kde/trunk/kdesupport
Revision: 862875
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
Revision: 862875
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase
Revision: 862875
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdepimlibs
Revision: 862878
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdepim
Revision: 862878
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdegraphics
Revision: 862878
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdemultimedia
Revision: 862879
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdenetwork
Revision: 862879
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeutils
Revision: 862879
URL: svn://anonsvn.kde.org/home/kde/trunk/playground/base/plasma
Revision: 862879
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeplasma-addons
Revision: 862879
URL: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdesdk
Revision: 862879

Backtrace:
Application: KDE Daemon (kded4), signal SIGSEGV
0x00007f3e46ddf315 in waitpid () from /lib/libpthread.so.0

Thread 1 (Thread 0x7f3e48a7c780 (LWP 19143)):
[KCrash Handler]
#4  0x0000000000000051 in ?? ()
#5  0x00007f3e3c4cd5da in ~Settings (this=0x6765f0) at /home/kde-devel/kde/src/KDE/kdebase/workspace/khotkeys/libkhotkeysprivate/settings.cpp:43
#6  0x00007f3e3c6ea278 in ~KHotKeysModule (this=0x6765d0) at /home/kde-devel/kde/src/KDE/kdebase/workspace/khotkeys/app/kded.cpp:58
#7  0x00007f3e4868005f in ~Kded (this=0x62a870) at /home/kde-devel/kde/src/KDE/kdelibs/kded/kded.cpp:153
#8  0x00007f3e48681832 in kdemain (argc=1, argv=0x7fff50aa9da8) at /home/kde-devel/kde/src/KDE/kdelibs/kded/kded.cpp:902
#9  0x0000000000400823 in main (argc=1, argv=0x7fff50aa9da8) at /home/kde-devel/kde/build/KDE/kdelibs/kded/kded4_dummy.cpp:3
Comment 1 Stefan Usenbinz 2008-09-21 11:59:32 UTC
Two things come to my mind that could cause a double deletion in the Settings destructor.
1. Settings::setActions should check for self-assignment of m_actions

delete m_actions;
m_actions = actions;

When actions happens to be the same pointer as m_actions (e.g. due to something along the lines of settings.setActions(settings.actions())) m_actions will point to a deleted object on exit of setActions. Deleting m_actions in the destructor then causes a double deletion and therefore a crash.
This is safer:

if (actions!=m_actions)
{
  delete m_actions;
  m_actions = actions;
}

Btw.: setGesturesExclude has a similar deficiency 

2. KHotKeysModule::reread_configuration() gets a copy of the actions pointer:
actions_root = _settings.actions();
and the KHotKeysModule destructor deletes it:
delete actions_root;
Then _settings destructor is invoked and since actions_root pointed to the same object as _settings.m_actions Settings destructor tries to delete an already deleted object.
If KHotKeysModule really needs actions_root (instead of using _settings.actions() which could be an inline getter in case performance is a concern) it should either claim ownership or not delete the ActionDataGroup.
Comment 2 Michael Jansen 2008-09-22 01:35:25 UTC
Solved with 863007