Bug 351643

Summary: KWin crashes closing the settings dialog and then switching a window
Product: [Plasma] kwin Reporter: Jan <medhefgo>
Component: coreAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash Flags: thomas.luebking: ReviewRequest+
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
URL: https://git.reviewboard.kde.org/r/124895/
Latest Commit: Version Fixed In: 5.4.1
Sentry Crash Report:
Attachments: crash trace

Description Jan 2015-08-23 14:11:14 UTC
KWin crash after opening the window manager settings dialog using the alt+f3 menu. After closing it and switching a window or right-clicking a window titlebar, KWin crashes. Please let me know if a new trace with more debug symbols is needed.

Note that this does not seem to be a duplicate of #346748 (and some others), because it crashes kwin itself and not kcmshell5 or kdeinit5.

Reproducible: Always
Comment 1 Jan 2015-08-23 14:11:58 UTC
Created attachment 94184 [details]
crash trace
Comment 2 Thomas Lübking 2015-08-23 14:39:42 UTC
Attachments aren't searchable
---------

Continuing.
[Thread 0x7fd2cdc8f700 (LWP 18248) exited]
[Thread 0x7fd2d4dec700 (LWP 18246) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00007fd2f062e16e in isNull (this=0xa31c60) at /usr/include/qt/QtCore/qsharedpointer_impl.h:585
585	    inline bool isNull() const { return d == 0 || d->strongref.load() == 0 || value == 0; }

Thread 6 (Thread 0x7fd2d78f4700 (LWP 18245)):
#0  0x00007fd2f0abc18d in poll () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007fd2ee5919f2 in ?? () from /usr/lib/libxcb.so.1
No symbol table info available.
#2  0x00007fd2ee59356f in xcb_wait_for_event () from /usr/lib/libxcb.so.1
No symbol table info available.
#3  0x00007fd2d8196ca9 in ?? () from /usr/lib/libQt5XcbQpa.so.5
No symbol table info available.
#4  0x00007fd2ee863a9e in ?? () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#5  0x00007fd2f0d874a4 in start_thread () from /usr/lib/libpthread.so.0
No symbol table info available.
#6  0x00007fd2f0ac512d in clone () from /usr/lib/libc.so.6
No symbol table info available.

Thread 4 (Thread 0x7fd2cffff700 (LWP 18247)):
#0  0x00007fd2f0abde23 in select () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007fd2eea9691f in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#2  0x00007fd2eea983f7 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timespec*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#3  0x00007fd2eea988fe in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#4  0x00007fd2eea4226a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#5  0x00007fd2ee85eaf4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#6  0x00007fd2e8d21335 in ?? () from /usr/lib/libQt5Qml.so.5
No symbol table info available.
#7  0x00007fd2ee863a9e in ?? () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#8  0x00007fd2f0d874a4 in start_thread () from /usr/lib/libpthread.so.0
No symbol table info available.
#9  0x00007fd2f0ac512d in clone () from /usr/lib/libc.so.6
No symbol table info available.

Thread 2 (Thread 0x7fd2cd48e700 (LWP 18249)):
#0  0x00007fd2f0d8d07f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
No symbol table info available.
#1  0x00007fd2ed7c0564 in ?? () from /usr/lib/libQt5Script.so.5
No symbol table info available.
#2  0x00007fd2ed7c05a9 in ?? () from /usr/lib/libQt5Script.so.5
No symbol table info available.
#3  0x00007fd2f0d874a4 in start_thread () from /usr/lib/libpthread.so.0
No symbol table info available.
#4  0x00007fd2f0ac512d in clone () from /usr/lib/libc.so.6
No symbol table info available.

Thread 1 (Thread 0x7fd2f12a7840 (LWP 18244)):
#0  0x00007fd2f062e16e in isNull (this=0xa31c60) at /usr/include/qt/QtCore/qsharedpointer_impl.h:585
No locals.
#1  KWin::UserActionsMenu::hasClient (this=0xa31bb0) at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/useractions.cpp:110
No locals.
#2  0x00007fd2f062904f in KWin::Workspace::setActiveClient (this=this@entry=0xa31970, c=c@entry=0x0) at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/activation.cpp:237
        blocker = <optimized out>
#3  0x00007fd2f062a102 in KWin::Workspace::activateNextClient (this=0xa31970, c=c@entry=0xba1f10) at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/activation.cpp:446
        get_focus = <optimized out>
        desktop = <optimized out>
#4  0x00007fd2f062a24c in KWin::Workspace::clientHidden (this=<optimized out>, c=c@entry=0xba1f10) at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/activation.cpp:410
        __PRETTY_FUNCTION__ = "void KWin::Workspace::clientHidden(KWin::AbstractClient*)"
#5  0x00007fd2f05c6ebf in KWin::Client::internalHide (this=0xba1f10) at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/client.cpp:977
        old = KWin::Client::Mapped
#6  0x00007fd2f05c733d in updateVisibility (this=0xba1f10) at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/client.cpp:740
No locals.
#7  KWin::Client::doMinimize (this=0xba1f10) at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/client.cpp:734
No locals.
#8  0x00007fd2f05c0505 in KWin::AbstractClient::minimize (this=0xba1f10, avoid_animation=<optimized out>)
    at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/abstract_client.cpp:375
        avoid_animation = false
        this = 0xba1f10
#9  0x00007fd2eea73eb1 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#10 0x00007fd2ef77e00c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#11 0x00007fd2ef7834e6 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#12 0x00007fd2eea4489b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#13 0x00007fd2eea46c96 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#14 0x00007fd2eea987c2 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#15 0x00007fd2d81fd35d in ?? () from /usr/lib/libQt5XcbQpa.so.5
No symbol table info available.
#16 0x00007fd2eea4226a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#17 0x00007fd2eea4a20c in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#18 0x00007fd2f0fa258f in kdemain (argc=2, argv=0x7ffd5669b6c8) at /tmp/yaourt-tmp-medhefgo/aur-kwin-git/src/kwin/main_x11.cpp:303
        primaryScreen = 0
        c = 0x0
        number_of_screens = <optimized out>
        a = {<KWin::Application> = {<QApplication> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x7fd2efe7f1a0 <QApplication::staticMetaObject>, 
                stringdata = 0x7fd2f077bcc0 <qt_meta_stringdata_KWin__Application>, data = 0x7fd2f077bbc0 <qt_meta_data_KWin__Application>, 
                static_metacall = 0x7fd2f072f670 <KWin::Application::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, 
                extradata = 0x0}}, m_originalSessionKey = {static null = {<No data fields>}, d = 0x7fd2eeaf7de0 <QArrayData::shared_null>}, m_eventFilter = {
              d = 0x9930e0}, m_configLock = false, m_operationMode = KWin::Application::OperationModeX11, m_x11Time = 7145296, m_rootWindow = 191, 
            m_connection = 0x94c320, static crashes = 0}, static staticMetaObject = {d = {superdata = 0x7fd2f09d4220 <KWin::Application::staticMetaObject>, 
              stringdata = 0x7fd2f0fa3320 <qt_meta_stringdata_KWin__ApplicationX11>, data = 0x7fd2f0fa32c0 <qt_meta_data_KWin__ApplicationX11>, 
              static_metacall = 0x7fd2f0fa2c00 <KWin::ApplicationX11::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, 
              extradata = 0x0}}, owner = {d = 0x9987e0}, m_replace = true}
        replaceOption = {d = {d = 0x99be20}}
        parser = {d = 0x9a1500}
        helper = {<QObject> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x7fd2eee81b80 <QObject::staticMetaObject>, 
              stringdata = 0x7fd2f07714a0 <qt_meta_stringdata_KWin__SessionSaveDoneHelper>, data = 0x7fd2f0771440 <qt_meta_data_KWin__SessionSaveDoneHelper>, 
              static_metacall = 0x7fd2f07305b0 <KWin::SessionSaveDoneHelper::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, 
              extradata = 0x0}}, notifier = 0x9bde00, conn = 0x9b1f70}
#19 0x00007fd2f09fc610 in __libc_start_main () from /usr/lib/libc.so.6
No symbol table info available.
#20 0x0000000000400819 in _start ()
No symbol table info available.
Comment 3 Thomas Lübking 2015-08-23 14:54:35 UTC
Notice that this backtrace is different from the other one and suggests that actually Workspace::m_userActionsMenu is garbage - what should totally not happen.
(It's constructed with the workspace and deleted with it)

Can you please apply

diff --git a/useractions.cpp b/useractions.cpp
index 9714a6e..ea422eb 100755
--- a/useractions.cpp
+++ b/useractions.cpp
@@ -98,6 +98,7 @@ UserActionsMenu::UserActionsMenu(QObject *parent)
 UserActionsMenu::~UserActionsMenu()
 {
     discard();
+    abort();
 }
 
 bool UserActionsMenu::isShown() const


and post an updated backtrace (the abort should not happen until KWin exits)
Comment 4 Jan 2015-08-23 15:39:56 UTC
Crash happens right after closing the settings window.


[Thread 0x7f49cb424700 (LWP 4629) exited]
[Thread 0x7f49d254f700 (LWP 4627) exited]

Program received signal SIGABRT, Aborted.
0x00007f49f23365f8 in raise () from /usr/lib/libc.so.6

Thread 6 (Thread 0x7f49d921d700 (LWP 4626)):
#0  0x00007f49f23e318d in poll () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007f49efeb99f2 in ?? () from /usr/lib/libxcb.so.1
No symbol table info available.
#2  0x00007f49efebb56f in xcb_wait_for_event () from /usr/lib/libxcb.so.1
No symbol table info available.
#3  0x00007f49d9abfca9 in ?? () from /usr/lib/libQt5XcbQpa.so.5
No symbol table info available.
#4  0x00007f49f018ba9e in ?? () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#5  0x00007f49f26ae4a4 in start_thread () from /usr/lib/libpthread.so.0
No symbol table info available.
#6  0x00007f49f23ec12d in clone () from /usr/lib/libc.so.6
No symbol table info available.

Thread 4 (Thread 0x7f49d186e700 (LWP 4628)):
#0  0x00007f49f23e4e23 in select () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007f49f03be91f in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#2  0x00007f49f03c03f7 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timespec*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#3  0x00007f49f03c08fe in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#4  0x00007f49f036a26a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#5  0x00007f49f0186af4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#6  0x00007f49ea64a335 in ?? () from /usr/lib/libQt5Qml.so.5
No symbol table info available.
#7  0x00007f49f018ba9e in ?? () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#8  0x00007f49f26ae4a4 in start_thread () from /usr/lib/libpthread.so.0
No symbol table info available.
#9  0x00007f49f23ec12d in clone () from /usr/lib/libc.so.6
No symbol table info available.

Thread 2 (Thread 0x7f49cac23700 (LWP 4630)):
#0  0x00007f49f26b407f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
No symbol table info available.
#1  0x00007f49ef0e9564 in ?? () from /usr/lib/libQt5Script.so.5
No symbol table info available.
#2  0x00007f49ef0e95a9 in ?? () from /usr/lib/libQt5Script.so.5
No symbol table info available.
#3  0x00007f49f26ae4a4 in start_thread () from /usr/lib/libpthread.so.0
No symbol table info available.
#4  0x00007f49f23ec12d in clone () from /usr/lib/libc.so.6
No symbol table info available.

Thread 1 (Thread 0x7f49f2bce840 (LWP 4625)):
#0  0x00007f49f23365f8 in raise () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007f49f2337a7a in abort () from /usr/lib/libc.so.6
No symbol table info available.
#2  0x00007f49f1f560fe in KWin::UserActionsMenu::~UserActionsMenu (this=0x25d2d70, __in_chrg=<optimized out>) at /home/medhefgo/kwin-git/src/kwin/useractions.cpp:101
No locals.
#3  0x00007f49f1f56109 in KWin::UserActionsMenu::~UserActionsMenu (this=0x25d2d70, __in_chrg=<optimized out>) at /home/medhefgo/kwin-git/src/kwin/useractions.cpp:102
No locals.
#4  0x00007f49f039bed0 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#5  0x00007f49f10a600c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#6  0x00007f49f10ab4e6 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#7  0x00007f49f036c89b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#8  0x00007f49f036ec96 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#9  0x00007f49f03c07c2 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#10 0x00007f49d9b2635d in ?? () from /usr/lib/libQt5XcbQpa.so.5
No symbol table info available.
#11 0x00007f49f036a26a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#12 0x00007f49f037220c in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#13 0x00007f49f28c955f in kdemain (argc=2, argv=0x7ffcadd612c8) at /home/medhefgo/kwin-git/src/kwin/main_x11.cpp:303
        primaryScreen = 0
        c = 0x0
        number_of_screens = <optimized out>
        a = {<KWin::Application> = {<QApplication> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x7f49f17a71a0 <QApplication::staticMetaObject>, 
                stringdata = 0x7f49f20a2a20 <qt_meta_stringdata_KWin__Application>, data = 0x7f49f20a2920 <qt_meta_data_KWin__Application>, 
                static_metacall = 0x7f49f2057660 <KWin::Application::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, 
                extradata = 0x0}}, m_originalSessionKey = {static null = {<No data fields>}, d = 0x7f49f041fde0 <QArrayData::shared_null>}, m_eventFilter = {
              d = 0x2533cc0}, m_configLock = false, m_operationMode = KWin::Application::OperationModeX11, m_x11Time = 12906334, m_rootWindow = 191, 
            m_connection = 0x24ed360, static crashes = 0}, static staticMetaObject = {d = {superdata = 0x7f49f22fb220 <KWin::Application::staticMetaObject>, 
              stringdata = 0x7f49f28ca2c0 <qt_meta_stringdata_KWin__ApplicationX11>, data = 0x7f49f28ca260 <qt_meta_data_KWin__ApplicationX11>, 
              static_metacall = 0x7f49f28c9bd0 <KWin::ApplicationX11::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, 
              extradata = 0x0}}, owner = {d = 0x25393e0}, m_replace = true}
        replaceOption = {d = {d = 0x253c8c0}}
        parser = {d = 0x2543080}
        helper = {<QObject> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x7f49f07a9b80 <QObject::staticMetaObject>, 
              stringdata = 0x7f49f2098200 <qt_meta_stringdata_KWin__SessionSaveDoneHelper>, data = 0x7f49f20981a0 <qt_meta_data_KWin__SessionSaveDoneHelper>, 
              static_metacall = 0x7f49f20585a0 <KWin::SessionSaveDoneHelper::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, 
              extradata = 0x0}}, notifier = 0x2544160, conn = 0x2552cf0}
#14 0x00007f49f2323610 in __libc_start_main () from /usr/lib/libc.so.6
No symbol table info available.
#15 0x00000000004007e9 in _start ()
No symbol table info available.
Detaching from program: /usr/bin/kwin_x11, process 4625
Comment 5 Thomas Lübking 2015-08-23 16:08:41 UTC
*cough*

diff --git a/useractions.cpp b/useractions.cpp
index 9714a6e..058e1cd 100755
--- a/useractions.cpp
+++ b/useractions.cpp
@@ -314,7 +314,7 @@ void UserActionsMenu::init()
                 p->setArguments(args);
                 p->setProcessEnvironment(kwinApp()->processStartupEnvironment());
                 p->setProgram(QStringLiteral("kcmshell5"));
-                connect(p, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, &QProcess::deleteLater);
+                connect(p, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), p, &QProcess::deleteLater);
                 connect(p, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), this,
                     [p] (QProcess::ProcessError e) {
                         if (e == QProcess::FailedToStart) {
Comment 6 Jan 2015-08-23 18:14:31 UTC
The patch fixes it.
Comment 7 Thomas Lübking 2015-08-23 19:03:15 UTC
Many thanks for reporting and testing this!
Comment 8 Martin Flöser 2015-08-24 06:48:37 UTC
wow, twice the same. That's impressive!
Comment 9 Thomas Lübking 2015-08-24 19:59:40 UTC
Git commit a97b6e0fd6a5eff53e3fccff825998feb4026a34 by Thomas Lübking.
Committed on 24/08/2015 at 19:58.
Pushed by luebking into branch 'Plasma/5.4'.

delete the quit process, not UserActinsMenu
FIXED-IN: 5.4.1
REVIEW: 124895

M  +1    -1    useractions.cpp

http://commits.kde.org/kwin/a97b6e0fd6a5eff53e3fccff825998feb4026a34