Bug 408940 - Adding virtual desktops can crash System Settings in KWin::DesktopsModel::desktopCreated()
Summary: Adding virtual desktops can crash System Settings in KWin::DesktopsModel::des...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.15.5
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 409231 464975 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-06-20 05:26 UTC by Diana
Modified: 2024-06-07 21:28 UTC (History)
4 users (show)

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


Attachments
backtrace (14.43 KB, text/plain)
2019-06-21 10:54 UTC, Diana
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Diana 2019-06-20 05:26:00 UTC
As the title says.


STEPS TO REPRODUCE
1. Open Workspace -> Desktop Behavior -> Virtual Desktops
2. Set rows > 1
3. Add a desktop VIA the Desktop Grid (Default hotkey: ctrl+F8)

OBSERVED RESULT

System Settings crashes with a segmentation fault

EXPECTED RESULT

System Settings does not crash with a segmentation fault

ADDITIONAL INFORMATION

Does not crash when Rows is 1.
Does not crash when rows is > 1 but desktops added through the settings page.
Comment 1 Nate Graham 2019-06-21 09:36:45 UTC
Pleas attach a backtrace of the crash.

https://community.kde.org/Get_Involved/Bug_Reporting#Crash_reports_must_include_backtraces
Comment 2 Diana 2019-06-21 10:54:05 UTC
Created attachment 121050 [details]
backtrace

Here
Comment 3 Nate Graham 2019-06-21 10:58:28 UTC
Thank you!

Thread 1 (Thread 0x7fa2955542c0 (LWP 1551)):
[KCrash Handler]
#6  0x00007fa258f5489d in std::__atomic_base<int>::load (__m=std::memory_order_relaxed, this=0xf00000001) at /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/g++-v8/bits/atomic_base.h:390
#7  QAtomicOps<int>::load<int> (_q_value=...) at /usr/include/qt5/QtCore/qatomic_cxx11.h:227
#8  QBasicAtomicInteger<int>::load (this=0xf00000001) at /usr/include/qt5/QtCore/qbasicatomic.h:103
#9  QtPrivate::RefCount::ref (this=0xf00000001) at /usr/include/qt5/QtCore/qrefcount.h:55
#10 QString::QString (other=..., this=0x7ffc8fb67218) at /usr/include/qt5/QtCore/qstring.h:958
#11 KWin::DesktopsModel::desktopCreated (this=0x55ea928c8ec0, id=..., data=...) at /var/tmp/portage/kde-plasma/kwin-5.15.5/work/kwin-5.15.5/kcmkwin/kwindesktop/desktopsmodel.cpp:503
#12 0x00007fa258f4a201 in KWin::DesktopsModel::qt_static_metacall (_o=_o@entry=0x55ea928c8ec0, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=7, _a=_a@entry=0x7ffc8fb67390) at kcmkwin/kwindesktop/kcm_kwin_virtualdesktops_autogen/EWIEGA46WW/moc_desktopsmodel.cpp:183
#13 0x00007fa258f4a947 in KWin::DesktopsModel::qt_metacall (this=0x55ea928c8ec0, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x7ffc8fb67390) at kcmkwin/kwindesktop/kcm_kwin_virtualdesktops_autogen/EWIEGA46WW/moc_desktopsmodel.cpp:315
Comment 4 Vlad Zahorodnii 2019-06-21 11:35:16 UTC
Argh, this piece of code assumes that only kcm adds virtual desktops (during synchronization)

        // Remove dummy data.
        const QString dummyId = m_desktops.at(data.position);

but that's not the case. It's also worth to point out that we can't just do

    if (uint(m_desktops.count()) < data.position) {
        // Replace the dummy virtual desktop with the actual one.
        emit dataChanged(idx, idx, { Id });
    } else {
        beginInsertRows();
        // Append the new virtual desktop.
        endInsertRows();
    }

because this will overwrite virtual desktops created by the user.
Comment 5 Patrick Silva 2019-07-14 13:52:09 UTC
bug 409231 seems related/duplicate
Comment 6 David Edmundson 2019-07-14 14:12:06 UTC
*** Bug 409231 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2023-02-06 18:05:51 UTC
*** Bug 464975 has been marked as a duplicate of this bug. ***
Comment 8 David Edmundson 2024-05-29 10:32:25 UTC
This bug is a crash report that is over a year old without any activity, as our software is always changing, the information in this ticket is unlikely to still be useful.

If this issue is still reproducible in a newer version of kwin (5.27.5 or 6.0) please reopen this ticket with a bumped version number or it will be closed in 30 days.
Comment 9 elman 2024-06-04 11:06:27 UTC
Can't reproduce my Bug 409231, so it's fixed for me. Thanks.