Bug 464707 - System Settings crashed in KScreen::Config::outputs() when changing settings and then saving or reverting
Summary: System Settings crashed in KScreen::Config::outputs() when changing settings ...
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_kscreen (show other bugs)
Version: 5.26.90
Platform: Arch Linux Linux
: HI crash
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords: drkonqi
: 465172 466291 466595 474457 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-01-23 18:15 UTC by Pawel
Modified: 2023-09-13 17:48 UTC (History)
12 users (show)

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


Attachments
New crash information added by DrKonqi (2.59 KB, text/plain)
2023-02-20 17:15 UTC, wojnilowicz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel 2023-01-23 18:15:10 UTC
Application: systemsettings (5.26.90)

Qt Version: 5.15.8
Frameworks Version: 5.102.0
Operating System: Linux 6.1.7-arch1-1 x86_64
Windowing System: Wayland
Distribution: "Arch Linux"
DrKonqi: 5.26.90 [KCrashBackend]

-- Information about the crash:
I was playing arounf the various settings in Display and Monitor KCM while Investigating bug 464702. For the record, I have 1 main monitor ASUS XG32VQR connected via DP. I occasionally connect an OLED LG TV (OLED65C7) via HDMI.
I was changing the scale slader on both the monitor and the TV and testing right click context menus associated with bug 464702 then randomly systemsettings crashed on me when I either pressed Apply or revert after changing the scale slider. This is on wayland - hopefully the KDE Crash Handler attached the full dump.

The reporter is unsure if this crash is reproducible.

-- Backtrace:
Application: System Settings (systemsettings), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  0x00007fcf30d27db8 in KScreen::Config::outputs() const (this=0x0) at /usr/src/debug/libkscreen/libkscreen-5.26.90/src/config.cpp:263
#7  0x00007fcf1f43db73 in KCMKScreen::checkConfig() (this=this@entry=0x7fcf5402b890) at /usr/src/debug/kscreen/kscreen-5.26.90/kcm/kcm.cpp:352
#8  0x00007fcf1f43ddd6 in KCMKScreen::continueNeedsSaveCheck(bool) (this=0x7fcf5402b890, needs=<optimized out>) at /usr/src/debug/kscreen/kscreen-5.26.90/kcm/kcm.cpp:379
#9  0x00007fcf5fcb1a70 in QObject::event(QEvent*) (this=0x7fcf5402b890, e=0x563873236640) at kernel/qobject.cpp:1347
#10 0x00007fcf60978b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x7fcf5402b890, e=0x563873236640) at kernel/qapplication.cpp:3640
#11 0x00007fcf5fc8de08 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x7fcf5402b890, event=0x563873236640) at kernel/qcoreapplication.cpp:1064
#12 0x00007fcf5fc8e913 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x5638714fc780) at kernel/qcoreapplication.cpp:1821
#13 0x00007fcf5fcd4d48 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x563871530240) at kernel/qeventdispatcher_glib.cpp:277
#14 0x00007fcf5e71682b in g_main_dispatch (context=0x7fcf54005010) at ../glib/glib/gmain.c:3454
#15 g_main_context_dispatch (context=0x7fcf54005010) at ../glib/glib/gmain.c:4172
#16 0x00007fcf5e76dcc9 in g_main_context_iterate.constprop.0 (context=0x7fcf54005010, block=1, dispatch=1, self=<optimized out>) at ../glib/glib/gmain.c:4248
#17 0x00007fcf5e7150e2 in g_main_context_iteration (context=0x7fcf54005010, may_block=1) at ../glib/glib/gmain.c:4313
#18 0x00007fcf5fcd8b2c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5638714da630, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#19 0x00007fcf5fc865ac in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7fff3a722da0, flags=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#20 0x00007fcf5fc910d9 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#21 0x00007fcf60139fe2 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1870
#22 0x00007fcf60976f2a in QApplication::exec() () at kernel/qapplication.cpp:2832
#23 0x0000563870cd4c07 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/systemsettings/systemsettings-5.26.90/app/main.cpp:188
[Inferior 1 (process 8365) detached]

Reported using DrKonqi
Comment 1 Pawel 2023-01-23 18:36:47 UTC
easily reproducible - apply/revert with different scale/primary monitor etc. and it will crash soon enough.

Another backtrace just now:

Application: System Settings (systemsettings), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  0x00007f34da9aadb8 in KScreen::Config::outputs() const (this=0x0) at /usr/src/debug/libkscreen/libkscreen-5.26.90/src/config.cpp:263
#7  0x00007f34d90c6b73 in KCMKScreen::checkConfig() (this=this@entry=0x7f350c00e4b0) at /usr/src/debug/kscreen/kscreen-5.26.90/kcm/kcm.cpp:352
#8  0x00007f34d90c6dd6 in KCMKScreen::continueNeedsSaveCheck(bool) (this=0x7f350c00e4b0, needs=<optimized out>) at /usr/src/debug/kscreen/kscreen-5.26.90/kcm/kcm.cpp:379
#9  0x00007f35198b1a70 in QObject::event(QEvent*) (this=0x7f350c00e4b0, e=0x55c8daea33f0) at kernel/qobject.cpp:1347
#10 0x00007f351a578b5c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x7f350c00e4b0, e=0x55c8daea33f0) at kernel/qapplication.cpp:3640
#11 0x00007f351988de08 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x7f350c00e4b0, event=0x55c8daea33f0) at kernel/qcoreapplication.cpp:1064
#12 0x00007f351988e913 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x55c8da482780) at kernel/qcoreapplication.cpp:1821
#13 0x00007f35198d4d48 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x55c8da4b6240) at kernel/qeventdispatcher_glib.cpp:277
#14 0x00007f351831682b in g_main_dispatch (context=0x7f350c005010) at ../glib/glib/gmain.c:3454
#15 g_main_context_dispatch (context=0x7f350c005010) at ../glib/glib/gmain.c:4172
#16 0x00007f351836dcc9 in g_main_context_iterate.constprop.0 (context=0x7f350c005010, block=1, dispatch=1, self=<optimized out>) at ../glib/glib/gmain.c:4248
#17 0x00007f35183150e2 in g_main_context_iteration (context=0x7f350c005010, may_block=1) at ../glib/glib/gmain.c:4313
#18 0x00007f35198d8b2c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55c8da460630, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#19 0x00007f35198865ac in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7ffc0b082410, flags=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#20 0x00007f35198910d9 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#21 0x00007f3519d39fe2 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1870
#22 0x00007f351a576f2a in QApplication::exec() () at kernel/qapplication.cpp:2832
#23 0x000055c8d8a5fc07 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/systemsettings/systemsettings-5.26.90/app/main.cpp:188
[Inferior 1 (process 18197) detached]
Comment 2 Nate Graham 2023-02-06 21:11:36 UTC
*** Bug 465172 has been marked as a duplicate of this bug. ***
Comment 3 wojnilowicz 2023-02-20 17:15:31 UTC
Created attachment 156539 [details]
New crash information added by DrKonqi

systemsettings (5.27.0) using Qt 5.15.8

Crash happened after failing to enable my external monitor.

-- Backtrace (Reduced):
#4  0x00007f4054a8f8b8 in KScreen::Config::outputs (this=0x0) at /usr/src/debug/libkscreen-qt5-5.27.0-1.fc37.x86_64/src/config.cpp:263
#5  0x00007f4054afb8a2 in KCMKScreen::checkConfig (this=this@entry=0x559f0bd1c8b0) at /usr/src/debug/kscreen-5.27.0-1.fc37.x86_64/kcm/kcm.cpp:352
#6  0x00007f4054afbb06 in KCMKScreen::continueNeedsSaveCheck (this=0x559f0bd1c8b0, needs=<optimized out>) at /usr/src/debug/kscreen-5.27.0-1.fc37.x86_64/kcm/kcm.cpp:379
#7  0x00007f406d2c8134 in QObject::event (this=0x559f0bd1c8b0, e=0x559f0d726080) at kernel/qobject.cpp:1347
#8  0x00007f406dfaed62 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x559f0bd1c8b0, e=0x559f0d726080) at kernel/qapplication.cpp:3640
Comment 4 Nate Graham 2023-02-22 21:09:47 UTC
*** Bug 465973 has been marked as a duplicate of this bug. ***
Comment 5 Bug Janitor Service 2023-02-23 17:02:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreen/-/merge_requests/184
Comment 6 Pawel 2023-02-23 18:37:19 UTC
(In reply to Bug Janitor Service from comment #5)
> A possibly relevant merge request was started @
> https://invent.kde.org/plasma/kscreen/-/merge_requests/184

I applied this patch on top of kscreen 5.27.1.1 on arch and I can no longer reproduce this issue. Thanks for the fix. 

I hope we can land it in 5.27.2
Comment 7 Arjen Hiemstra 2023-02-23 21:09:28 UTC
Git commit 087fb6d16d7bfd7248888b6fe5074313f19f3f64 by Arjen Hiemstra.
Committed on 23/02/2023 at 17:02.
Pushed by ngraham into branch 'master'.

kcm: Guard against config being null in checkConfig()

This method is called from a queued signal and can be called when the
config has been unset. Most of the other methods are already guarded
against this but this one was not, causing crashes.

M  +4    -0    kcm/kcm.cpp

https://invent.kde.org/plasma/kscreen/commit/087fb6d16d7bfd7248888b6fe5074313f19f3f64
Comment 8 Nate Graham 2023-02-23 21:41:54 UTC
Git commit f219615dd17f061a104daa2a2902ae3b48b2b97b by Nate Graham, on behalf of Arjen Hiemstra.
Committed on 23/02/2023 at 21:12.
Pushed by ngraham into branch 'Plasma/5.27'.

kcm: Guard against config being null in checkConfig()

This method is called from a queued signal and can be called when the
config has been unset. Most of the other methods are already guarded
against this but this one was not, causing crashes.


(cherry picked from commit 087fb6d16d7bfd7248888b6fe5074313f19f3f64)

M  +4    -0    kcm/kcm.cpp

https://invent.kde.org/plasma/kscreen/commit/f219615dd17f061a104daa2a2902ae3b48b2b97b
Comment 9 Nate Graham 2023-02-24 19:35:17 UTC
*** Bug 466291 has been marked as a duplicate of this bug. ***
Comment 10 adavila89+kde 2023-02-27 17:05:38 UTC
*** Bug 465973 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2023-02-28 22:15:31 UTC
*** Bug 466595 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2023-09-13 17:48:26 UTC
*** Bug 474457 has been marked as a duplicate of this bug. ***