Bug 431508 - Crash in kglobalaccel setting
Summary: Crash in kglobalaccel setting
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keys (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Jansen
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-01-12 15:36 UTC by David Edmundson
Modified: 2021-01-19 17:19 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Edmundson 2021-01-12 15:36:04 UTC
Split from https://bugs.kde.org/show_bug.cgi?id=426047 # 26


- What I was doing when the application crashed:
Configuring global shotcuts

- Unusual behavior I noticed:
I saved the shortcuts with apply button but they didn't actually works, also all shorcuts are unconfigured, I can't do an Alt + Tab

- Custom settings of the application:

-- Backtrace (Reduced):
#4  0x00007fcd25320504 in KGlobalShortcutInfo::componentUniqueName() const () from /lib64/libKF5GlobalAccel.so.5
#6  0x00007fccf0cad232 in QtPrivate::QFunctorSlotObject<GlobalAccelModel::addApplication(QString const&, QString const&)::{lambda()#2}::operator()() const::{lambda()#2}, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) () from /usr/lib64/qt5/plugins/kcms/kcm_keys.so
#7  0x00007fcd2670b386 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#8  0x00007fcd254ae383 in QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*) () from /lib64/libQt5DBus.so.5
#9  0x00007fcd26703d1e in QObject::event(QEvent*) () from /lib64/libQt5Core.so.5



----- 

Reading the code it's clear what's wrong

        connect(infoWatcher, &QDBusPendingCallWatcher::finished, this, [=] {


A reply can be valid but empty. At which point calling info[0].componentUniqueName(); 
 obviously crashes.

I don't know if it's safe to just guard in the lambda.
Comment 1 David Redondo 2021-01-12 15:45:44 UTC
I think guarding should be ok but seems underlying there is something  weird happening. The user picks an application from the dialog, which should have a valid desktopfile, which means we should have at least on valid action in there (launching the applciation)
Comment 2 Bug Janitor Service 2021-01-18 09:18:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/307
Comment 3 David Redondo 2021-01-18 14:49:01 UTC
Git commit ea08472b0fc87001ef700e5743342390103dff53 by David Redondo.
Committed on 18/01/2021 at 14:48.
Pushed by davidre into branch 'master'.

Guard against an empty response when adding Applications

One would expect to always have at least one action here, namely the launch
action corresponding to the Exec entry. But we have a crash where it looks like
that we got an empty list, guarding against that does no harm.

M  +5    -1    kcms/keys/globalaccelmodel.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/ea08472b0fc87001ef700e5743342390103dff53