Bug 465892

Summary: Nullpointerexception in plasma-workspace-5.27.0/shell/desktopview.cpp:120
Product: [Plasma] plasmashell Reporter: Sven Eden <sven>
Component: Desktop ContainmentAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: crash CC: admin, akselmo, aleixpol, kde, krzysiek, nate, notmart, qydwhotmail
Priority: NOR Keywords: drkonqi, multiscreen
Version: 5.27.0   
Target Milestone: 1.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: New crash information added by DrKonqi

Description Sven Eden 2023-02-17 06:42:00 UTC
Application: plasmashell (5.27.0)
 (Compiled from sources)
Qt Version: 5.15.8
Frameworks Version: 5.103.0
Operating System: Linux 6.1.12-gentoo x86_64
Windowing System: X11
Distribution: "Gentoo Linux"
DrKonqi: 5.27.0 [KCrashBackend]

-- Information about the crash:
Gridcoin (minimized to tray) and BOINC where running, like almost every evening, when I locked the session, turned off my monitors, disabled my laptops panel (DnD-Mode) and went to bed.

This morning I was greeted with the crash handler.
This never happened before upgrading to Plasma 5.27.0.

Main screen is a 2K screen at 144Hz. Secondary are my laptop panel and an extra HDMI connected monitor, both in FHD.
xrandr information:
Screen 0: minimum 8 x 8, current 6400 x 1440, maximum 32767 x 32767
eDP-1-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
DP-4    connected primary 2560x1440+1920+0 (normal left inverted right x axis y axis) 600mm x 340mm
HDMI-0  connected 1920x1080+4480+0 (normal left inverted right x axis y axis) 510mm x 290mm

--------

The reporter is unsure if this crash is reproducible.

-- Backtrace:
Application: Plasma (plasmashell), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = 0x0}
[KCrash Handler]
#6  QWeakPointer<QObject>::internalData() const (this=0x58) at /usr/include/qt5/QtCore/qsharedpointer_impl.h:696
#7  QPointer<QScreen>::data() const (this=0x58) at /usr/include/qt5/QtCore/qpointer.h:77
#8  QPointer<QScreen>::operator QScreen*() const (this=0x58) at /usr/include/qt5/QtCore/qpointer.h:83
#9  DesktopView::screenToFollow() const (this=0x0) at /data/portage/portage/kde-plasma/plasma-workspace-5.27.0/work/plasma-workspace-5.27.0/shell/desktopview.cpp:120
#10 0x00005590525b3a40 in ShellCorona::screenInvariants() const (this=0x559053c418e0) at /data/portage/portage/kde-plasma/plasma-workspace-5.27.0/work/plasma-workspace-5.27.0/shell/shellcorona.cpp:828
#11 0x00007ff960cab90c in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc18d19300, r=0x559053c418e0, this=0x55905443a000) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#12 doActivate<false>(QObject*, int, void**) (sender=0x559053c41a08, signal_index=3, argv=0x7ffc18d19300) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/src/corelib/kernel/qobject.cpp:3923
#13 0x00007ff960ca581f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7ff960f49300 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffc18d19300) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/src/corelib/kernel/qobject.cpp:3983
#14 0x00007ff960cafa0a in QTimer::timeout(QTimer::QPrivateSignal) (this=<optimized out>, _t1=...) at .moc/moc_qtimer.cpp:205
#15 0x00007ff960ca37ed in QObject::event(QEvent*) (this=0x559053c41a08, e=0x7ffc18d19460) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/src/corelib/kernel/qobject.cpp:1369
#16 0x00007ff961962fbe in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x559053c41a08, e=0x7ffc18d19460) at /data/portage/portage/dev-qt/qtwidgets-5.15.8-r2/work/qtbase-everywhere-src-5.15.8/src/widgets/kernel/qapplication.cpp:3640
#17 0x00007ff960c78f28 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x559053c41a08, event=0x7ffc18d19460) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/src/corelib/kernel/qcoreapplication.cpp:1064
#18 0x00007ff960cc86a9 in QTimerInfoList::activateTimers() (this=0x559053726dd0) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/src/corelib/kernel/qtimerinfo_unix.cpp:643
#19 0x00007ff960cc8f44 in timerSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/src/corelib/kernel/qeventdispatcher_glib.cpp:183
#20 0x00007ff95f935998 in g_main_dispatch (context=0x7ff954005010) at ../glib-2.74.5/glib/gmain.c:3454
#21 g_main_context_dispatch (context=context@entry=0x7ff954005010) at ../glib-2.74.5/glib/gmain.c:4172
#22 0x00007ff95f935c28 in g_main_context_iterate (context=context@entry=0x7ff954005010, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib-2.74.5/glib/gmain.c:4248
#23 0x00007ff95f935cbc in g_main_context_iteration (context=0x7ff954005010, may_block=1) at ../glib-2.74.5/glib/gmain.c:4313
#24 0x00007ff960cc92e6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x559053726c00, flags=...) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/src/corelib/kernel/qeventdispatcher_glib.cpp:423
#25 0x00007ff960c77a0b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffc18d196a0, flags=..., flags@entry=...) at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/include/QtCore/../../src/corelib/global/qflags.h:69
#26 0x00007ff960c7fb90 in QCoreApplication::exec() () at /data/portage/portage/dev-qt/qtcore-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/include/QtCore/../../src/corelib/global/qflags.h:121
#27 0x00007ff96110daec in QGuiApplication::exec() () at /data/portage/portage/dev-qt/qtgui-5.15.8-r3/work/qtbase-everywhere-src-5.15.8/src/gui/kernel/qguiapplication.cpp:1870
#28 0x00007ff961962f35 in QApplication::exec() () at /data/portage/portage/dev-qt/qtwidgets-5.15.8-r2/work/qtbase-everywhere-src-5.15.8/src/widgets/kernel/qapplication.cpp:2832
#29 0x0000559052587da9 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /data/portage/portage/kde-plasma/plasma-workspace-5.27.0/work/plasma-workspace-5.27.0/shell/main.cpp:235
[Inferior 1 (process 13605) detached]

Reported using DrKonqi
Comment 1 Bug Janitor Service 2023-02-17 12:30:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2637
Comment 2 Marco Martin 2023-02-17 15:17:30 UTC
*** Bug 465935 has been marked as a duplicate of this bug. ***
Comment 3 Marco Martin 2023-02-17 16:44:06 UTC
Git commit d715af8f0c33a74b84ce2ebd22bc4009a91a33b6 by Marco Martin.
Committed on 17/02/2023 at 16:43.
Pushed by mart into branch 'master'.

Better screen removal handling

handleScreenRemoved never actually removed any view, as we were
comparing the screen id wit hthe screen order length, which is updated
only after the signal handler is done.
Also, make really sure to remove the desktop view from m_desktopViewForScreen
by searching the view itslef and not just by the index of lastscreen.
Crash in 465892 seems to indicate that sich a removal by index failed
leaving a dangling pointer in the map

M  +11   -8    shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/d715af8f0c33a74b84ce2ebd22bc4009a91a33b6
Comment 4 Marco Martin 2023-02-17 18:29:43 UTC
Git commit 8bc6be2f1af41274d8209272fca58ec7fe454416 by Marco Martin.
Committed on 17/02/2023 at 16:45.
Pushed by mart into branch 'Plasma/5.27'.

Better screen removal handling

handleScreenRemoved never actually removed any view, as we were
comparing the screen id wit hthe screen order length, which is updated
only after the signal handler is done.
Also, make really sure to remove the desktop view from m_desktopViewForScreen
by searching the view itslef and not just by the index of lastscreen.
Crash in 465892 seems to indicate that sich a removal by index failed
leaving a dangling pointer in the map

M  +11   -8    shell/shellcorona.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/8bc6be2f1af41274d8209272fca58ec7fe454416
Comment 5 Krzysztof Cybulski 2023-08-30 05:32:44 UTC
Created attachment 161277 [details]
New crash information added by DrKonqi

plasmashell (5.27.7) using Qt 5.15.10

This crash is happening when KDE user in multi monitor setup and you disable KScreen 2

-- Backtrace (Reduced):
#6  QWeakPointer<QObject>::internalData (this=0x60) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qsharedpointer_impl.h:702
#7  QPointer<QScreen>::data (this=0x60) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qpointer.h:77
#8  QPointer<QScreen>::operator QScreen* (this=0x60) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qpointer.h:83
#9  DesktopView::screenToFollow (this=0x0) at ./shell/desktopview.cpp:123
#10 0x000056009fac63cf in ShellCorona::screenInvariants (this=0x5600a0ad3500) at ./shell/shellcorona.cpp:828
Comment 6 Krzysztof Cybulski 2023-08-30 07:01:06 UTC
ReOpening #5
Comment 7 Akseli Lahtinen 2024-01-10 14:16:44 UTC

*** This bug has been marked as a duplicate of bug 474868 ***
Comment 8 Nate Graham 2024-01-11 16:01:37 UTC

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