Bug 443858 - systemsettings5 reliably crashes when opening the power kcm via the overview in icon view mode
Summary: systemsettings5 reliably crashes when opening the power kcm via the overview ...
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: iconview (show other bugs)
Version: 5.23.0
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: drkonqi
: 448104 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-16 22:34 UTC by Christian (Fuchs)
Modified: 2022-01-11 04:58 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23.5


Attachments
New crash information added by DrKonqi (3.93 KB, text/plain)
2021-12-21 04:55 UTC, Fushan Wen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian (Fuchs) 2021-10-16 22:34:50 UTC
Application: systemsettings5 (5.23.0)

Qt Version: 5.15.2
Frameworks Version: 5.87.0
Operating System: Linux 5.14.11-200.fc34.x86_64 x86_64
Windowing System: X11
Distribution: Fedora 34 (KDE Plasma)
DrKonqi: 5.23.0 [KCrashBackend]

-- Information about the crash:
- What I was doing when the application crashed:

Open Systemsettings5 on my desktop PC (no battery, no power profiles etc.) and then open the power kcm

This only happens when I use icons view for systemsettings, and not with sidebar view. 
This also doesn't happen when opening the kcm through either the battery systray applet or via kcmshell.

The crash can be reproduced every time.

-- Backtrace:
Application: Systemeinstellungen (systemsettings5), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f8f2569563a in QComboBox::clear() () from /lib64/libQt5Widgets.so.5
#5  0x00007f8ef2779d04 in PowerDevil::BundledActions::PowerProfileConfig::buildUi()::{lambda(QDBusPendingCallWatcher*)#5}::operator()(QDBusPendingCallWatcher*) const () from /usr/lib64/qt5/plugins/powerdevilpowerprofileaction_config.so
#6  0x00007f8f249e63a9 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#7  0x00007f8f235dda33 in QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*) () from /lib64/libQt5DBus.so.5
#8  0x00007f8f249dcf09 in QObject::event(QEvent*) () from /lib64/libQt5Core.so.5
#9  0x00007f8f25588443 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#10 0x00007f8f249b2798 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#11 0x00007f8f249b5d06 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /lib64/libQt5Core.so.5
#12 0x00007f8f24a040d7 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt5Core.so.5
#13 0x00007f8f227324cf in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#14 0x00007f8f227864f8 in g_main_context_iterate.constprop () from /lib64/libglib-2.0.so.0
#15 0x00007f8f2272fc03 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#16 0x00007f8f24a03b78 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#17 0x00007f8f249b11a2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#18 0x00007f8f249b96e4 in QCoreApplication::exec() () from /lib64/libQt5Core.so.5
#19 0x000055946553d62c in main ()
[Inferior 1 (process 38278) detached]

Possible duplicates by query: bug 443857, bug 443722, bug 443671, bug 443656, bug 443421.

Reported using DrKonqi
Comment 1 Nate Graham 2021-10-17 23:04:54 UTC
Can reproduce only in Icon view, indeed. Strange.


PowerDevil::BundledActions::PowerProfileConfig::buildUi()::{lambda(QDBusPendingCallWatcher*)#5}::operator()(QDBusPendingCallWatcher*) const () from /usr/lib64/qt5/plugins/powerdevilpowerprofileaction_config.so
#6  0x00007f8f249e63a9 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
Comment 2 Fushan Wen 2021-12-21 04:55:15 UTC
Created attachment 144739 [details]
New crash information added by DrKonqi

systemsettings (5.23.80) using Qt 5.15.2

- What I was doing when the application crashed:
Set view mode to Icon mode, and open Power Management.

-- Backtrace (Reduced):
#6  0x00007fd921c8838a in QComboBox::clear() (this=0x7fd9257a5200) at widgets/qcombobox.cpp:3049
#7  0x00007fd8e35f0714 in operator()(QDBusPendingCallWatcher*) const (__closure=0x7fd923d30770, watcher=<optimized out>) at /usr/src/debug/powerdevil5-5.23.80git.20211219T014229~a4208c0c-ku.29.2.x86_64/daemon/actions/bundled/powerprofileconfig.cpp:83
#8  0x00007fd920f01043 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc55c98cf0, r=0x7fd90c01af20, this=0x7fd923d30760) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#9  doActivate<false>(QObject*, int, void**) (sender=0x7fd9249a57d0, signal_index=3, argv=0x7ffc55c98cf0) at kernel/qobject.cpp:3886
[...]
#11 0x00007fd92010bfff in QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*) (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qdbuspendingcall.cpp:158
Comment 3 Bug Janitor Service 2021-12-21 08:34:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/75
Comment 4 Bug Janitor Service 2021-12-21 08:56:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/systemsettings/-/merge_requests/108
Comment 5 Bug Janitor Service 2021-12-23 04:50:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/systemsettings/-/merge_requests/109
Comment 6 Fushan Wen 2021-12-23 09:11:00 UTC
Git commit 9b8a9dfda3d3d8df167336ce3f029af8bf0401f5 by Fushan Wen.
Committed on 23/12/2021 at 04:54.
Pushed by fusionfuture into branch 'master'.

powerprofileconfig: Use m_profileCombo as the watcher's parent

`m_profileCombo` could be an invalid pointer, because when clicking an
item, `QAbstractItemView::clicked` and `QAbstractItemView::activated` in
systemsettings both will be emitted, and `IconMode::changeModule` will be
called twice, and `closeModules()` will free `m_profileCombo` in the
second call, which will crash systemsettings.

To fix the crash, set the watcher's parent to `m_profileCombo`, so when
`m_profileCombo` is destroyed, the watcher is also destroyed and the
connection is disconnected to prevent modification to the old `m_profileCombo`.

M  +1    -1    daemon/actions/bundled/powerprofileconfig.cpp

https://invent.kde.org/plasma/powerdevil/commit/9b8a9dfda3d3d8df167336ce3f029af8bf0401f5
Comment 7 Fushan Wen 2021-12-23 09:11:52 UTC
Git commit 575ae1a1ef14e8a0c5b8382a283a8776dbbc3d08 by Fushan Wen.
Committed on 23/12/2021 at 09:11.
Pushed by fusionfuture into branch 'Plasma/5.23'.

powerprofileconfig: Use m_profileCombo as the watcher's parent

`m_profileCombo` could be an invalid pointer, because when clicking an
item, `QAbstractItemView::clicked` and `QAbstractItemView::activated` in
systemsettings both will be emitted, and `IconMode::changeModule` will be
called twice, and `closeModules()` will free `m_profileCombo` in the
second call, which will crash systemsettings.

To fix the crash, set the watcher's parent to `m_profileCombo`, so when
`m_profileCombo` is destroyed, the watcher is also destroyed and the
connection is disconnected to prevent modification to the old `m_profileCombo`.


(cherry picked from commit 9b8a9dfda3d3d8df167336ce3f029af8bf0401f5)

M  +1    -1    daemon/actions/bundled/powerprofileconfig.cpp

https://invent.kde.org/plasma/powerdevil/commit/575ae1a1ef14e8a0c5b8382a283a8776dbbc3d08
Comment 8 Nicolas Fella 2022-01-08 13:38:54 UTC
*** Bug 448104 has been marked as a duplicate of this bug. ***
Comment 9 Nicolas Fella 2022-01-08 13:43:33 UTC
@Fushan is there anything left to do here or can this be closed?
Comment 10 Fushan Wen 2022-01-08 13:45:33 UTC
Sorry I use the wrong CCBUG. I think it can be closed, though the MR in systemsettings is not merged, the crash was fixed.
Comment 11 Fushan Wen 2022-01-11 04:58:43 UTC
Git commit 0e02f4a552018d65272b34d5bb05fdf8d81372f2 by Fushan Wen.
Committed on 08/01/2022 at 13:48.
Pushed by ngraham into branch 'master'.

Use styleHint to enable opening an item on single click

Connecting both clicked and activated signals causes unnecessary reloading
of KCMs when clicking files or folders is set to open them, and will
crash systemsettings when opening Powerdevil settings.

This commit uses QProxyStyle to set style hint in CategorizedView.
`QStyle::SH_ItemView_ActivateItemOnSingleClick` now always returns 1
regardless of the behavior settings, so an item will always be opened on
single click.

M  +1    -0    icons/CategorizedView.cpp
M  +23   -0    icons/CategorizedView.h
M  +0    -1    icons/IconMode.cpp

https://invent.kde.org/plasma/systemsettings/commit/0e02f4a552018d65272b34d5bb05fdf8d81372f2