Bug 411953 - FolderView crashes when dragging rubber band on desktop
Summary: FolderView crashes when dragging rubber band on desktop
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Desktop icons & Folder View widget (other bugs)
Version First Reported In: master
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-16 06:29 UTC by Jonathan Marten
Modified: 2019-09-18 07:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.12.10
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2019-09-16 06:29:42 UTC
SUMMARY

Since a recent Plasma update, the Folder View as desktop containment asserts when starting to drag a rubber band around the desktop:

Application: Plasma (plasmashell), signal: Aborted
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7faafc3b1880 (LWP 9384))]

Thread 5 (Thread 0x7faae3fff700 (LWP 9392)):
[KCrash Handler]
#7  0x00007fab025ab3a4 in raise () from /lib64/libc.so.6
#8  0x00007fab02594536 in abort () from /lib64/libc.so.6
#9  0x00007fab02bb1607 in qt_message_fatal (context=..., message=<synthetic pointer>...) at qtcore-5.13.9999/src/corelib/global/qlogging.cpp:1907
#10 QMessageLogger::fatal (this=this@entry=0x7faae3ffe690, msg=msg@entry=0x7fab02ea24b8 "ASSERT failure in %s: \"%s\", file %s, line %d") at qtcore-5.13.9999/src/corelib/global/qlogging.cpp:888
#11 0x00007fab02bb07e7 in qt_assert_x (where=where@entry=0x7fab03dbff9e "QWidget", what=what@entry=0x7fab03dbfd08 "Widgets must be created in the GUI thread.", file=file@entry=0x7fab03dbeee8 "qtwidgets-5.13.9999/src/widgets/kernel/qwidget.cpp", line=line@entry=1144) at ../../include/QtCore/../../../qtcore-5.13.9999/src/corelib/global/qlogging.h:91
#12 0x00007fab039b213b in QWidgetPrivate::init (this=0x7faadca0d9d0, parentWidget=<optimized out>, f=...) at ../../include/QtCore/../../../qtwidgets-5.13.9999/src/corelib/global/qlogging.h:91
#13 0x00007fab03a34785 in QDesktopWidget::QDesktopWidget (this=0x7faadc28c950) at ../../include/QtCore/../../../qtwidgets-5.13.9999/src/corelib/tools/qlist.h:159
#14 0x00007fab039d2ab5 in QApplication::desktop () at qtwidgets-5.13.9999/src/widgets/kernel/qapplication.cpp:2752
#15 0x00007fab039d2aea in QApplication::fontMetrics () at qtwidgets-5.13.9999/src/widgets/kernel/qapplication.cpp:1785
#16 0x00007faae2dcc20e in RubberBand::paint (this=0x5563c0213320, painter=0x7faae3ffe8d8) at /usr/include/qt5/QtCore/qcoreapplication.h:116
#17 0x00007fab0505b769 in QSGDefaultPainterNode::paint() () from /usr/lib64/libQt5Quick.so.5
#18 0x00007fab0505c56c in QSGDefaultPainterNode::update() () from /usr/lib64/libQt5Quick.so.5
#19 0x00007fab0510d6fa in QQuickPaintedItem::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) () from /usr/lib64/libQt5Quick.so.5
#20 0x00007fab050be68f in QQuickWindowPrivate::updateDirtyNode(QQuickItem*) () from /usr/lib64/libQt5Quick.so.5
#21 0x00007fab050befab in QQuickWindowPrivate::updateDirtyNodes() () from /usr/lib64/libQt5Quick.so.5
#22 0x00007fab050c04c2 in QQuickWindowPrivate::syncSceneGraph() () from /usr/lib64/libQt5Quick.so.5
#23 0x00007fab05062c90 in QSGRenderThread::sync(bool) () from /usr/lib64/libQt5Quick.so.5
#24 0x00007fab050640b4 in QSGRenderThread::syncAndRender() () from /usr/lib64/libQt5Quick.so.5
#25 0x00007fab05067980 in QSGRenderThread::run() () from /usr/lib64/libQt5Quick.so.5
#26 0x00007fab02c02701 in QThreadPrivate::start (arg=0x5563be2bc890) at qtcore-5.13.9999/src/corelib/thread/qthread_unix.cpp:360
#27 0x00007fab017fb588 in start_thread () from /lib64/libpthread.so.0
#28 0x00007fab0267a88f in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7faafc3b1880 (LWP 9384)):
#0  0x00007fab01802434 in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fab02c090c3 in QWaitConditionPrivate::wait (deadline=..., this=0x5563be039de0) at qtcore-5.13.9999/src/corelib/thread/qwaitcondition_unix.cpp:146
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x5563be2bc8d0, deadline=...) at qtcore-5.13.9999/src/corelib/thread/qwaitcondition_unix.cpp:225
#3  0x00007fab02c091d9 in QWaitCondition::wait (this=0x5563be2bc8d8, mutex=0x5563be2bc8d0, time=<optimized out>) at ../../include/QtCore/../../../qtcore-5.13.9999/src/corelib/kernel/qdeadlinetimer.h:68
#4  0x00007fab05065d50 in QSGThreadedRenderLoop::polishAndSync(QSGThreadedRenderLoop::Window*, bool) () from /usr/lib64/libQt5Quick.so.5
#5  0x00007fab0506692c in QSGThreadedRenderLoop::handleUpdateRequest(QQuickWindow*) () from /usr/lib64/libQt5Quick.so.5
#6  0x00007fab050cd1d3 in QQuickWindow::event(QEvent*) () from /usr/lib64/libQt5Quick.so.5
#7  0x00007fab039d2c22 in QApplicationPrivate::notify_helper (this=this@entry=0x5563bdae8050, receiver=receiver@entry=0x5563bddef510, e=e@entry=0x7fff4d471fc0) at qtwidgets-5.13.9999/src/widgets/kernel/qapplication.cpp:3703
#8  0x00007fab039dbb30 in QApplication::notify (this=0x7fff4d472600, receiver=0x5563bddef510, e=0x7fff4d471fc0) at qtwidgets-5.13.9999/src/widgets/kernel/qapplication.cpp:3449
#9  0x00007fab02dbf1df in QCoreApplication::notifyInternal2 (receiver=0x5563bddef510, event=0x7fff4d471fc0) at qtcore-5.13.9999/src/corelib/kernel/qcoreapplication.cpp:1095
#10 0x00007fab031d8edc in QPlatformWindow::deliverUpdateRequest (this=<optimized out>) at qtgui-5.13.9999/src/gui/kernel/qplatformwindow.cpp:793
#11 0x00007fab031d72be in QPlatformWindow::windowEvent (this=0x5563be003ce0, event=<optimized out>) at qtgui-5.13.9999/src/gui/kernel/qplatformwindow.cpp:478
#12 0x00007fab039db8b3 in QApplication::notify (this=0x7fff4d472600, receiver=0x5563bddef510, e=0x7fff4d472250) at qtwidgets-5.13.9999/src/widgets/kernel/qapplication.cpp:2909
#13 0x00007fab02dbf1df in QCoreApplication::notifyInternal2 (receiver=0x5563bddef510, event=0x7fff4d472250) at qtcore-5.13.9999/src/corelib/kernel/qcoreapplication.cpp:1095
#14 0x00007fab02e1a4db in QTimerInfoList::activateTimers (this=0x5563bdb3ddb0) at qtcore-5.13.9999/src/corelib/kernel/qtimerinfo_unix.cpp:643
#15 0x00007fab02e1ade1 in timerSourceDispatch (source=<optimized out>) at qtcore-5.13.9999/src/corelib/kernel/qeventdispatcher_glib.cpp:183
#16 0x00007faaff63a11d in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#17 0x00007faaff63a3c0 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#18 0x00007faaff63a46c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#19 0x00007fab02e1b145 in QEventDispatcherGlib::processEvents (this=0x5563bdb54910, flags=...) at qtcore-5.13.9999/src/corelib/kernel/qeventdispatcher_glib.cpp:423
#20 0x00007fab02dbd95b in QEventLoop::exec (this=this@entry=0x7fff4d4724b0, flags=..., flags@entry=...) at ../../include/QtCore/../../../qtcore-5.13.9999/src/corelib/global/qflags.h:140
#21 0x00007fab02dc64cf in QCoreApplication::exec () at ../../include/QtCore/../../../qtcore-5.13.9999/src/corelib/global/qflags.h:120
#22 0x00007fab031dd67c in QGuiApplication::exec () at qtgui-5.13.9999/src/gui/kernel/qguiapplication.cpp:1788
#23 0x00007fab039d2b85 in QApplication::exec () at qtwidgets-5.13.9999/src/widgets/kernel/qapplication.cpp:2859
#24 0x00005563bbfd2499 in main (argc=<optimized out>, argv=<optimized out>) at plasma-workspace/shell/main.cpp:219
[Inferior 1 (process 9384) detached]

Suspect that this may be a consequence of commit a8efa865, or some other elimination of QDesktopWidget.  QDesktopWidget performs a once only construction of a QWidget, but if no QDesktopWidget has yet been created in the GUI thread then the first use will be in RubberBand::paint() when it accesses QApplication::fontMetrics() which uses a QDesktopWidget internally.  Unfortunately the RubberBand is running in the render thread and fails with the assert.

The easy solution seems to be to remove the initialisation of opt.fontMetrics = qApp->fontMetrics() in RubberBand::paint().  The font metrics are not required to paint the rubber band.  Without this line, the rubber band does not crash and is drawn correctly.




SOFTWARE/OS VERSIONS
KDE Plasma Version: GIT df34f2d07
KDE Frameworks Version: 5.62.0
Qt Version: 5.13.1
Comment 1 Kai Uwe Broulik 2019-09-18 07:20:33 UTC
Git commit eb9c5f32edbca7876bc8c0de5ef4a8f610c30a09 by Kai Uwe Broulik.
Committed on 18/09/2019 at 07:20.
Pushed by broulik into branch 'Plasma/5.12'.

[Folder View] Don't explicitly initialize fontMetrics

qApp->fontMetrics() calls desktop() which creates a QDesktopWidget and might do so on a non-main thread in case of threaded rendering.
FIXED-IN: 5.12.10

Differential Revision: https://phabricator.kde.org/D23980

M  +0    -1    containments/desktop/plugins/folder/rubberband.cpp

https://commits.kde.org/plasma-desktop/eb9c5f32edbca7876bc8c0de5ef4a8f610c30a09