Bug 342444

Summary: Dialog crash in Dekstop sidebar
Product: [Frameworks and Libraries] libplasma Reporter: Kai Uwe Broulik <kde>
Component: libplasmaquickAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: crash CC: franz.trischberger, kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Kai Uwe Broulik 2015-01-03 15:01:16 UTC
When switching between activities Plasma regularly crashes. The QQuickItem is guarded by a QPointer but that one doesn't notice it is gone resulting in a crash. Perhaps because the mainItem of the dialog is a Loader (I've had a lot of trouble with Loaders and async and outside deletion myself) and when switching activities the Desktop containment qml is destroyed and then you move your mouse over the dialog just when it's about to disappear and then it gets confused and blows up

#0  0x00007ffff6c06c88 in QPointer<QQuickItem>::operator QQuickItem*() const ()                    
   from /usr/lib/x86_64-linux-gnu/libKF5PlasmaQuick.so.5                                           
#1  0x00007ffff6c0bac4 in PlasmaQuick::DialogPrivate::mainItemContainsPosition(QPointF const&) const () from /usr/lib/x86_64-linux-gnu/libKF5PlasmaQuick.so.5
#2  0x00007ffff6c0e421 in PlasmaQuick::Dialog::event(QEvent*) ()                                   
   from /usr/lib/x86_64-linux-gnu/libKF5PlasmaQuick.so.5                                           
#3  0x00007ffff30240ec in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()                 
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5                                               
#4  0x00007ffff30295c0 in QApplication::notify(QObject*, QEvent*) ()                               
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5                                               
#5  0x00007ffff23498fb in QCoreApplication::notifyInternal(QObject*, QEvent*) ()                   
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5                                                  
#6  0x000000000047e841 in ?? ()                                                                    
#7  0x00007fffff7ff550 in ?? ()                                                                    
#8  0x00000000017585f0 in ?? ()                                                                    
#9  0x00007fffff7ff5f0 in ?? ()                                                                    
#10 0x00007ffff6c0e5f3 in PlasmaQuick::Dialog::event(QEvent*) ()                                   
   from /usr/lib/x86_64-linux-gnu/libKF5PlasmaQuick.so.5                  

Reproducible: Always

Steps to Reproduce:
1. Have two activities
2. Use your Desktop as normal
3. Occasionally switch activities

Actual Results:  
Plasma will blow up at some point.

Expected Results:  
It does not blow up
Comment 1 Kai Uwe Broulik 2015-01-03 15:44:54 UTC
I was able to reproduce it consistently:
- Open activity manager
- Choose a different activity
- Move your mouse a bit
Boom! If you don't move your mouse it doesn't crash because the "redirect mouse events inside the dialog" codepath isn't hit
Comment 2 Kai Uwe Broulik 2015-01-03 23:29:53 UTC
This problem can be reproduced with the following testcase. Just run it in qmlscene, press the button, click the pink area while repeatedly moving your cursor around inside the area and on its edges while it's disappearing. Boom!

import QtQuick 2.0

import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents

PlasmaComponents.Button {
    id: root
    signal close
    onClose: dialog.visible = false

    text: "Press Me"

    onClicked: {
        dialog.visible = true
        loader.active = true
    }

    PlasmaCore.Dialog {
        id: dialog

        location: PlasmaCore.Types.LeftEdge
        type: PlasmaCore.Dialog.Dock
        flags: Qt.Dock
        x: 0

        Component.onCompleted: flags = flags |  Qt.WindowStaysOnTopHint

        mainItem: Loader {
            id: loader
            width: item ? item.width : 0
            sourceComponent: Rectangle {
                width: 300
                height: 500
                color: "#f0f"

                MouseArea {
                    anchors.fill: parent
                    onClicked: {
                        processDummy.model = 1000 // pretend that work is being done
                        root.close() // do the close of the dialog via a signal
                        loader.active = false // unload the component
                        processDummy.model = 0
                    }
                }
            }
            active: false
        }
    }

    Repeater {
        id: processDummy
        Text { text: index }
    }

}
Comment 3 Marco Martin 2015-01-13 11:57:53 UTC
the test case is reproducible, that's the bt i get

#0  0xffffffff in ucstrncmp(QChar const*, uchar const*, int) (a=0x8081c28, c=0xb179907c "xcb", l=3) at tools/qstring.cpp:606
#1  0xffffffff in ucstrcmp(QChar const*, int, uchar const*, int) (a=0x8081c28, alen=3, b=0xb179907c "xcb", blen=3) at tools/qstring.cpp:647
#2  0xffffffff in QString::compare_helper(QChar const*, int, QLatin1String, Qt::CaseSensitivity) (data1=0x8081c28, length1=3, s2=..., cs=Qt::CaseSensitive) at tools/qstring.cpp:5274
#3  0xffffffff in QString::operator==(QLatin1String) const (this=0xbf80023c, other=...)
    at tools/qstring.cpp:2538
#4  0xffffffff in QX11Info::isPlatformX11() () at qx11info_x11.cpp:83
#5  0xffffffff in Breeze::Helper::isX11() () at /opt/kde5/lib/plugins/styles/breeze.so
#6  0xffffffff in Breeze::WindowManager::supportWMMoveResize() const ()
---Type <return> to continue, or q <return> to quit---    at /opt/kde5/lib/plugins/styles/breeze.so                                                                                     
#7  0xffffffff in Breeze::WindowManager::useWMMoveResize() const ()                         
    at /opt/kde5/lib/plugins/styles/breeze.so                                               
#8  0xffffffff in Breeze::AppEventFilter::eventFilter(QObject*, QEvent*) ()                 
    at /opt/kde5/lib/plugins/styles/breeze.so                                               
#9  0xffffffff in QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject*, QEvent*) (this=0x807e8b8, receiver=0x8412548, event=0xbf8008b0)                                 
    at kernel/qcoreapplication.cpp:1007                                                     
#10 0xffffffff in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=              
    0x807e8b8, receiver=0x8412548, e=0xbf8008b0) at kernel/qapplication.cpp:3697            
#11 0xffffffff in QApplication::notify(QObject*, QEvent*) (this=                            
---Type <return> to continue, or q <return> to quit---    0xbfffecdc, receiver=0x8412548, e=0xbf8008b0) at kernel/qapplication.cpp:3164                                                 
#12 0xffffffff in QCoreApplication::notifyInternal(QObject*, QEvent*) (this=0xbfffecdc, receiver=0x8412548, event=0xbf8008b0) at kernel/qcoreapplication.cpp:930                        
#13 0xffffffff in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x8412548, event=0xbf8008b0)                                                                                 
    at /home/diau/git/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:228                                                                                         
#14 0xffffffff in PlasmaQuick::Dialog::event(QEvent*) (this=0x8412548, event=0xbf801140)    
    at /home/diau/git/kf5/frameworks/plasma-framework/src/plasmaquick/dialog.cpp:1054       
#15 0xffffffff in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=0x807e8b8, receiver=0x8412548, e=0xbf801140) at kernel/qapplication.cpp:3722
---Type <return> to continue, or q <return> to quit---
Comment 4 Marco Martin 2015-01-13 12:05:46 UTC
this with fusion theme, maybe there are 2 different bugs here?

#0  0xffffffff in PlasmaQuick::Dialog::event(QEvent*) (this=0x8420078, event=0xbf8008b0)                                                                                          
    at /home/diau/git/kf5/frameworks/plasma-framework/src/plasmaquick/dialog.cpp:1028       
#1  0xffffffff in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=
    0x807e8b8, receiver=0x8420078, e=0xbf8008b0) at kernel/qapplication.cpp:3722
#2  0xffffffff in QApplication::notify(QObject*, QEvent*) (this=
    0xbfffecdc, receiver=0x8420078, e=0xbf8008b0) at kernel/qapplication.cpp:3164
#3  0xffffffff in QCoreApplication::notifyInternal(QObject*, QEvent*) (this=0xbfffecdc, receiver=0x8420078, event=0xbf8008b0) at kernel/qcoreapplication.cpp:930
#4  0xffffffff in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x8420078, event=0xbf8008b0)
    at /home/diau/git/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:228
#5  0xffffffff in PlasmaQuick::Dialog::event(QEvent*) (this=0x8420078, event=0xbf801140)
---Type <return> to continue, or q <return> to quit---    at /home/diau/git/kf5/frameworks/plasma-framework/src/plasmaquick/dialog.cpp:1054                                             
#6  0xffffffff in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=0x807e8b8, receiver=0x8420078, e=0xbf801140) at kernel/qapplication.cpp:3722                              
#7  0xffffffff in QApplication::notify(QObject*, QEvent*) (this=0xbfffecdc, receiver=0x8420078, e=0xbf801140) at kernel/qapplication.cpp:3164                                           
#8  0xffffffff in QCoreApplication::notifyInternal(QObject*, QEvent*) (this=0xbfffecdc, receiver=0x8420078, event=0xbf801140) at kernel/qcoreapplication.cpp:930                        
#9  0xffffffff in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x8420078, event=0xbf801140)                                                                                 
    at /home/diau/git/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:228                                                                                         
#10 0xffffffff in PlasmaQuick::Dialog::event(QEvent*) (this=0x8420078, event=0xbf8019d0)    
    at /home/diau/git/kf5/frameworks/plasma-framework/src/plasmaquick/dialog.cpp:1054
Comment 5 Marco Martin 2015-01-13 12:18:42 UTC
Git commit af0dffd89bde034e903360f4dc3d2c024e6cbcd9 by Marco Martin.
Committed on 13/01/2015 at 12:18.
Pushed by mart into branch 'master'.

don't forward events if not visible anymore
Change-Id: I58bfd951e4f55d07c8f3327881354a678a7f65ba

M  +15   -5    src/plasmaquick/dialog.cpp

http://commits.kde.org/plasma-framework/af0dffd89bde034e903360f4dc3d2c024e6cbcd9
Comment 6 Franz Trischberger 2015-02-09 12:02:08 UTC
I get a crash caused by infinite recursion (frameworks 5.6.0, plasma-5.2.0, Qt-5.4.0 on Gentoo):
#0  0x00007f0a0b534d85 in QQuickItem::mapToScene (this=<optimized out>, point=...) at items/qquickitem.cpp:7065
#1  0x00007f0a0cfae005 in PlasmaQuick::DialogPrivate::mainItemContainsPosition (this=0x21f33b0, point=...)
    at /var/tmp/portage/kde-frameworks/plasma-5.6.0/work/plasma-framework-5.6.0/src/plasmaquick/dialog.cpp:615
#2  0x00007f0a0cfaffeb in PlasmaQuick::Dialog::event (this=0x21f1d40, event=0x7fffe37cf728)
    at /var/tmp/portage/kde-frameworks/plasma-5.6.0/work/plasma-framework-5.6.0/src/plasmaquick/dialog.cpp:1047
#3  0x00007f0a097f79b9 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x21f1d40, e=0x7fffe37cf728) at kernel/qapplication.cpp:3722
#4  0x00007f0a097fb406 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=<optimized out>) at kernel/qapplication.cpp:3164
#5  0x00007f0a08deacd4 in QCoreApplication::notifyInternal (this=0x7fffe3fcc5f8, receiver=0x21f1d40, event=0x7fffe37cf728) at kernel/qcoreapplication.cpp:932
#6  0x00007f0a0cfb00e9 in sendEvent (receiver=0x21f1d40, event=0x0) at /usr/include/qt5/QtCore/qcoreapplication.h:228
#7  PlasmaQuick::Dialog::event (this=0x21f1d40, event=<optimized out>)
    at /var/tmp/portage/kde-frameworks/plasma-5.6.0/work/plasma-framework-5.6.0/src/plasmaquick/dialog.cpp:1054
#8  0x00007f0a097f79b9 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x21f1d40, e=0x7fffe37cfc68) at kernel/qapplication.cpp:3722
#9  0x00007f0a097fb406 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=<optimized out>) at kernel/qapplication.cpp:3164
#10 0x00007f0a08deacd4 in QCoreApplication::notifyInternal (this=0x7fffe3fcc5f8, receiver=0x21f1d40, event=0x7fffe37cfc68) at kernel/qcoreapplication.cpp:932
#11 0x00007f0a0cfb00e9 in sendEvent (receiver=0x21f1d40, event=0x0) at /usr/include/qt5/QtCore/qcoreapplication.h:228
#12 PlasmaQuick::Dialog::event (this=0x21f1d40, event=<optimized out>)
    at /var/tmp/portage/kde-frameworks/plasma-5.6.0/work/plasma-framework-5.6.0/src/plasmaquick/dialog.cpp:1054
#13 0x00007f0a097f79b9 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x21f1d40, e=0x7fffe37d01a8) at kernel/qapplication.cpp:3722
#14 0x00007f0a097fb406 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=<optimized out>) at kernel/qapplication.cpp:3164
#15 0x00007f0a08deacd4 in QCoreApplication::notifyInternal (this=0x7fffe3fcc5f8, receiver=0x21f1d40, event=0x7fffe37d01a8) at kernel/qcoreapplication.cpp:932
#16 0x00007f0a0cfb00e9 in sendEvent (receiver=0x21f1d40, event=0x0) at /usr/include/qt5/QtCore/qcoreapplication.h:228
#17 PlasmaQuick::Dialog::event (this=0x21f1d40, event=<optimized out>)
    at /var/tmp/portage/kde-frameworks/plasma-5.6.0/work/plasma-framework-5.6.0/src/plasmaquick/dialog.cpp:1054
#18 0x00007f0a097f79b9 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x21f1d40, e=0x7fffe37d06e8) at kernel/qapplication.cpp:3722
#19 0x00007f0a097fb406 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=<optimized out>) at kernel/qapplication.cpp:3164
#20 0x00007f0a08deacd4 in QCoreApplication::notifyInternal (this=0x7fffe3fcc5f8, receiver=0x21f1d40, event=0x7fffe37d06e8) at kernel/qcoreapplication.cpp:932
#21 0x00007f0a0cfb00e9 in sendEvent (receiver=0x21f1d40, event=0x0) at /usr/include/qt5/QtCore/qcoreapplication.h:228
#22 PlasmaQuick::Dialog::event (this=0x21f1d40, event=<optimized out>)
    at /var/tmp/portage/kde-frameworks/plasma-5.6.0/work/plasma-framework-5.6.0/src/plasmaquick/dialog.cpp:1054
#23 0x00007f0a097f79b9 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x21f1d40, e=0x7fffe37d0c28) at kernel/qapplication.cpp:3722
#24 0x00007f0a097fb406 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=<optimized out>) at kernel/qapplication.cpp:3164
#25 0x00007f0a08deacd4 in QCoreApplication::notifyInternal (this=0x7fffe3fcc5f8, receiver=0x21f1d40, event=0x7fffe37d0c28) at kernel/qcoreapplication.cpp:932
#26 0x00007f0a0cfb00e9 in sendEvent (receiver=0x21f1d40, event=0x0) at /usr/include/qt5/QtCore/qcoreapplication.h:228
#27 PlasmaQuick::Dialog::event (this=0x21f1d40, event=<optimized out>)
    at /var/tmp/portage/kde-frameworks/plasma-5.6.0/work/plasma-framework-5.6.0/src/plasmaquick/dialog.cpp:1054
#28 0x00007f0a097f79b9 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x21f1d40, e=0x7fffe37d1168) at kernel/qapplication.cpp:3722
#29 0x00007f0a097fb406 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=<optimized out>) at kernel/qapplication.cpp:3164
#30 0x00007f0a08deacd4 in QCoreApplication::notifyInternal (this=0x7fffe3fcc5f8, receiver=0x21f1d40, event=0x7fffe37d1168) at kernel/qcoreapplication.cpp:932
#31 0x00007f0a0cfb00e9 in sendEvent (receiver=0x21f1d40, event=0x0) at /usr/include/qt5/QtCore/qcoreapplication.h:228

Looked at the sources and found the above commit. As I did not run plasma prior to 5.2.0 I can't say if it is the same crash or a different one.