Bug 345809

Summary: Kwin crashes when switching windows after switching displays
Product: [Plasma] kwin Reporter: Nikhil Marathe <nsm.nikhil>
Component: xrandrAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: crash    
Priority: NOR    
Version: 5.2.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nikhil Marathe 2015-04-02 16:55:35 UTC
I have a intel graphics Lenovo x230 running archlinux. At work I have a dell external monitor.
I have dbus hooks that, when i plug in the monitor (via VGA), uses xrandr to switch to the monitor and disable the primary laptop display, and vice versa.  This problem occurs on both switches.

Here is the switcher script:
---------
#!/bin/bash
export XAUTHORITY=/home/nikhil/.Xauthority
export DISPLAY=:0.0
 
function connect {
  xrandr --output VGA1 --auto --output DP1 --auto --output LVDS1 --off
}
 
function disconnect {
  xrandr --output VGA1 --auto --output DP1 --auto --output LVDS1 --auto
}
 
xrandr | grep -e "\(DP1\|VGA1\) connected" &> /dev/null && connect || disconnect
----------

Now, after I switch displays, if I switch windows using my custom shortcut of Meta+Tab, kwin will crash within a few seconds. I can force a crash by being aggressive about the switching.

Unfortunately, drkonqi does not launch. Only useful info is a SIGSEGV.


Reproducible: Always

Steps to Reproduce:
1. Connect/disconnect external monitor to cause kwin to switch displays
2. Keep hitting switch-windows shortcut (Meta+Tab in my case) a couple of times.


Actual Results:  
Crash

Expected Results:  
Don't crash
Comment 1 Thomas Lübking 2015-04-02 17:36:31 UTC
I bet on bug #341497, but without a backtrace (gdb connect kwin_x11 before triggering the segfault?) there's absolutely nothing we can do here :-(

$ echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
$ gdb --pid `pidof kwin_x11` 2>&1 | tee kwin.gdb
> continue
[crash]
> bt
[hit enter until the end of the stack is reached]
> detach
> quit
Comment 2 Nikhil Marathe 2015-04-02 17:55:28 UTC
Program received signal SIGSEGV, Segmentation fault.
0x00007fdf6682fb00 in QScreen::handle() const () from /usr/lib/libQt5Gui.so.5
(gdb) bt
#0  0x00007fdf6682fb00 in QScreen::handle() const () from /usr/lib/libQt5Gui.so.5
#1  0x00007fdf521496b5 in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#2  0x00007fdf52136851 in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#3  0x00007fdf6680e4f6 in QWindowPrivate::create(bool) () from /usr/lib/libQt5Gui.so.5
#4  0x00007fdf6680e888 in QWindow::winId() const () from /usr/lib/libQt5Gui.so.5
#5  0x00007fdf3c893570 in ?? () from /usr/lib/libKF5PlasmaQuick.so.5
#6  0x00007fdf3c8955d9 in ?? () from /usr/lib/libKF5PlasmaQuick.so.5
#7  0x00007fdf6650b309 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#8  0x00007fdf6680d8a2 in QWindow::visibleChanged(bool) () from /usr/lib/libQt5Gui.so.5
#9  0x00007fdf66810c67 in QWindow::setVisible(bool) () from /usr/lib/libQt5Gui.so.5
#10 0x00007fdf3c893420 in PlasmaQuick::Dialog::setVisible(bool) () from /usr/lib/libKF5PlasmaQuick.so.5
#11 0x00007fdf3c89766a in PlasmaQuick::Dialog::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libKF5PlasmaQuick.so.5
#12 0x00007fdf60c4ec74 in QQmlVMEMetaObject::metaCall(QMetaObject::Call, int, void**) () from /usr/lib/libQt5Qml.so.5
#13 0x00007fdf60c69d6f in QQmlPropertyPrivate::write(QObject*, QQmlPropertyData const&, QVariant const&, QQmlContextData*, QFlags<QQmlPropertyPrivate::WriteFlag>) ()
   from /usr/lib/libQt5Qml.so.5
#14 0x00007fdf60c6b7eb in QQmlPropertyPrivate::writeValueProperty(QObject*, QQmlPropertyData const&, QVariant const&, QQmlContextData*, QFlags<QQmlPropertyPrivate::WriteFlag>) () from /usr/lib/libQt5Qml.so.5
#15 0x00007fdf60c6bf21 in QQmlPropertyPrivate::writeBinding(QObject*, QQmlPropertyData const&, QQmlContextData*, QQmlJavaScriptExpression*, QV4::ValueRef, bool, QFlags<QQmlPropertyPrivate::WriteFlag>) () from /usr/lib/libQt5Qml.so.5
#16 0x00007fdf60cdfe0f in QQmlBinding::update(QFlags<QQmlPropertyPrivate::WriteFlag>) () from /usr/lib/libQt5Qml.so.5
#17 0x00007fdf60ce056e in QQmlBinding::expressionChanged(QQmlJavaScriptExpression*) () from /usr/lib/libQt5Qml.so.5
#18 0x00007fdf60cba007 in QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) () from /usr/lib/libQt5Qml.so.5
#19 0x00007fdf60c573dc in QQmlData::signalEmitted(QAbstractDeclarativeData*, QObject*, int, void**) () from /usr/lib/libQt5Qml.so.5
#20 0x00007fdf6650aa81 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#21 0x00007fdf6793d3a9 in ?? () from /usr/lib/libkwin.so.5
#22 0x00007fdf6795ced5 in ?? () from /usr/lib/libkwin.so.5
#23 0x00007fdf6650b309 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#24 0x00007fdf66519108 in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/libQt5Core.so.5
#25 0x00007fdf6650c023 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
#26 0x00007fdf66dc1acc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#27 0x00007fdf66dc6f10 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#28 0x00007fdf664dad1b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#29 0x00007fdf66531f6d in QTimerInfoList::activateTimers() () from /usr/lib/libQt5Core.so.5
#30 0x00007fdf66530713 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#31 0x00007fdf5218ad0d in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#32 0x00007fdf664d87b2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#33 0x00007fdf664e018c in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#34 0x00007fdf67fa0adb in kdemain () from /usr/lib/libkdeinit5_kwin_x11.so
#35 0x00007fdf67c19800 in __libc_start_main () from /usr/lib/libc.so.6
#36 0x00000000004007b9 in _start ()
Comment 3 Thomas Lübking 2015-04-02 18:11:29 UTC
Is dupe, very nasty Qt bug.
You get no Dr. Konqui cause Dr. Konqui crashes as well :-(

I can only suggest to  make the xrandr calls individual to ensure there's always at least one screen.

The Qt bug is afair fixed in Qt 5.5 (but no guarantees)

*** This bug has been marked as a duplicate of bug 341497 ***