Bug 466960

Summary: Crash in KScreen::Config::supportedFeatures() while trying to save changed screen layout
Product: [Applications] systemsettings Reporter: Arcadiy Ivanov <arcadiy>
Component: kcm_kscreenAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: kde, nate, plasma-bugs
Priority: NOR Keywords: drkonqi
Version: 5.27.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 5.27.5
Sentry Crash Report:

Description Arcadiy Ivanov 2023-03-06 18:27:30 UTC
Application: systemsettings (5.27.2)

Qt Version: 5.15.8
Frameworks Version: 5.103.0
Operating System: Linux 6.1.14-200.fc37.x86_64 x86_64
Windowing System: X11
Distribution: "Fedora release 37 (Thirty Seven)"
DrKonqi: 5.27.2 [KCrashBackend]

-- Information about the crash:
The KScreen lost the screen layout, While trying to restore it activating one monitor at a time the KScreen went into infinite loop during the apply countdown, with all monitors refreshing/flashing resolution resets. After the laptop was unplugged from the doc to arrest the loop, there was a crash.

The crash can be reproduced sometimes.

-- Backtrace:
Application: System Settings (systemsettings), signal: Segmentation fault

[KCrash Handler]
#4  0x00007fe5c8a9b854 in KScreen::Config::supportedFeatures() const () from /lib64/libKF5Screen.so.8
#5  0x00007fe5c8b09488 in KCMKScreen::doSave() () from /usr/lib64/qt5/plugins/plasma/kcms/systemsettings/kcm_kscreen.so
#6  0x00007fe5c8b0b2f0 in KCMKScreen::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib64/qt5/plugins/plasma/kcms/systemsettings/kcm_kscreen.so
#7  0x00007fe5c8b0bf8b in KCMKScreen::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib64/qt5/plugins/plasma/kcms/systemsettings/kcm_kscreen.so
#8  0x00007fe5ffee96e3 in QQmlObjectOrGadget::metacall(QMetaObject::Call, int, void**) const () from /lib64/libQt5Qml.so.5
#9  0x00007fe5ffdc06ad in CallPrecise(QQmlObjectOrGadget const&, QQmlPropertyData const&, QV4::ExecutionEngine*, QV4::CallData*, QMetaObject::Call) () from /lib64/libQt5Qml.so.5
#10 0x00007fe5ffdc3a60 in QV4::QObjectMethod::callInternal(QV4::Value const*, QV4::Value const*, int) const () from /lib64/libQt5Qml.so.5
#11 0x00007fe5ffde0a5d in QV4::Moth::VME::interpret(QV4::CppStackFrame*, QV4::ExecutionEngine*, char const*) () from /lib64/libQt5Qml.so.5
#12 0x00007fe5ffde41c7 in QV4::Moth::VME::exec(QV4::CppStackFrame*, QV4::ExecutionEngine*) () from /lib64/libQt5Qml.so.5
#13 0x00007fe5ffd75636 in QV4::Function::call(QV4::Value const*, QV4::Value const*, int, QV4::ExecutionContext const*) () from /lib64/libQt5Qml.so.5
#14 0x00007fe5fff04161 in QQmlJavaScriptExpression::evaluate(QV4::CallData*, bool*) () from /lib64/libQt5Qml.so.5
#15 0x00007fe5ffeb4aff in QQmlBoundSignalExpression::evaluate(void**) () from /lib64/libQt5Qml.so.5
#16 0x00007fe5ffeb6288 in QQmlBoundSignal_callback(QQmlNotifierEndpoint*, void**) () from /lib64/libQt5Qml.so.5
#17 0x00007fe5ffee91af in QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) () from /lib64/libQt5Qml.so.5
#18 0x00007fe6020d0b70 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#19 0x00007fe5fd33aa50 in QQuickDialogButtonBoxPrivate::handleClick() () from /lib64/libQt5QuickTemplates2.so.5
#20 0x00007fe6020d0e96 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#21 0x00007fe6020d0e96 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#22 0x00007fe5fd314726 in QQuickAction::triggered(QObject*) () from /lib64/libQt5QuickTemplates2.so.5
#23 0x00007fe5fd316f0e in QQuickActionPrivate::trigger(QObject*, bool) () from /lib64/libQt5QuickTemplates2.so.5
#24 0x00007fe5fd317074 in QQuickActionPrivate::handleShortcutEvent(QObject*, QShortcutEvent*) () from /lib64/libQt5QuickTemplates2.so.5
#25 0x00007fe60209d2b1 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#26 0x00007fe602daed52 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#27 0x00007fe60209d4e8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#28 0x00007fe6025969a2 in QShortcutMap::dispatchEvent(QKeyEvent*) () from /lib64/libQt5Gui.so.5
#29 0x00007fe602596fe3 in QShortcutMap::tryShortcut(QKeyEvent*) () from /lib64/libQt5Gui.so.5
#30 0x00007fe60254d2fa in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () from /lib64/libQt5Gui.so.5
#31 0x00007fe602567391 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /lib64/libQt5Gui.so.5
#32 0x00007fe602549f1c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Gui.so.5
#33 0x00007fe5fcc80a7e in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt5XcbQpa.so.5
#34 0x00007fe600863c7f in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#35 0x00007fe6008ba118 in g_main_context_iterate.constprop () from /lib64/libglib-2.0.so.0
#36 0x00007fe600860f00 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#37 0x00007fe6020ee5fa in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#38 0x00007fe60209bf3a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#39 0x00007fe6020a4002 in QCoreApplication::exec() () from /lib64/libQt5Core.so.5
#40 0x00005594c564c5ea in main ()
[Inferior 1 (process 1743684) detached]

Reported using DrKonqi
Comment 1 Nate Graham 2023-03-07 19:59:44 UTC
Well that seems bad. :/
Comment 2 Bug Janitor Service 2023-04-17 14:03:08 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreen/-/merge_requests/203
Comment 3 Harald Sitter 2023-04-18 08:55:53 UTC
Git commit 0bfa16bd2b59ac9b2ce8112c06d86e5e29c69654 by Harald Sitter.
Committed on 17/04/2023 at 14:02.
Pushed by sitter into branch 'master'.

don't stumble over nullptrs if outputs changed during saving

exec() opens a nested eventloop that does event processing and may end
up processing output changes when e.g. a screen is getting unplugged. as
part of this our m_configHandler may get reset to null, so make sure the
pointers are still valid after exec

M  +7    -0    kcm/kcm.cpp

https://invent.kde.org/plasma/kscreen/commit/0bfa16bd2b59ac9b2ce8112c06d86e5e29c69654
Comment 4 Harald Sitter 2023-04-18 12:15:42 UTC
Git commit 8af1cfac332f6f7c4e6db40c851dd5ac719236f1 by Harald Sitter.
Committed on 18/04/2023 at 08:56.
Pushed by sitter into branch 'Plasma/5.27'.

don't stumble over nullptrs if outputs changed during saving

exec() opens a nested eventloop that does event processing and may end
up processing output changes when e.g. a screen is getting unplugged. as
part of this our m_configHandler may get reset to null, so make sure the
pointers are still valid after exec


(cherry picked from commit 0bfa16bd2b59ac9b2ce8112c06d86e5e29c69654)

M  +7    -0    kcm/kcm.cpp

https://invent.kde.org/plasma/kscreen/commit/8af1cfac332f6f7c4e6db40c851dd5ac719236f1