Bug 451233

Summary: (SEGV) Systemsettings crashed in InputDevice::name() while loading
Product: [Applications] systemsettings Reporter: postix <postix>
Component: kcm_tabletAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: aleixpol, arojas, nate, postix, robin, srijan4
Priority: NOR    
Version: 5.24.2   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.6
Attachments: Stracktrace (thread apply all bt)
Stracktrace (bt full)

Description postix 2022-03-07 12:13:48 UTC
Created attachment 147345 [details]
Stracktrace (thread apply all bt)

SUMMARY

```
Thread 1 (Thread 0x7fafcd171980 (LWP 9322)):
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=11, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007fafd00641e3 in __pthread_kill_internal (signo=11, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007fafd0014306 in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26
#3  0x00007fafd1be7d36 in KCrash::defaultCrashHandler (sig=11) at /usr/src/debug/kcrash-5.91.0-1.1.x86_64/src/kcrash.cpp:624
#4  <signal handler called>
#5  0x00007faf5035339c in QScopedPointer<OrgKdeKWinInputDeviceInterface, QScopedPointerDeleter<OrgKdeKWinInputDeviceInterface> >::data (this=0x228) at /usr/include/qt5/QtCore/qscopedpointer.h:138
#6  InputDevice::Prop<QString>::value (this=0x55ccb7884a70) at /usr/src/debug/plasma5-desktop-5.24.2-2.1.x86_64/build/kcms/tablet/kcm_tablet_autogen/EWIEGA46WW/../../../../../kcms/tablet/inputdevice.h:114
#7  0x00007faf50353b59 in InputDevice::name (this=<optimized out>) at /usr/src/debug/plasma5-desktop-5.24.2-2.1.x86_64/kcms/tablet/inputdevice.h:39
#8  DevicesModel::data (this=<optimized out>, index=..., role=0) at /usr/src/debug/plasma5-desktop-5.24.2-2.1.x86_64/kcms/tablet/devicesmodel.cpp:74
#9  0x00007fafcd90aadd in QModelIndex::data (arole=<optimized out>, this=0x7fff55367ae0) at /usr/include/qt5/QtCore/qabstractitemmodel.h:460
#10 VDMAbstractItemModelDataType::value (this=<optimized out>, model=..., index=0, role=...) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qmlmodels/qqmladaptormodel.cpp:477
#11 0x00007fafcd90d1e4 in QQmlAdaptorModel::value (role=..., index=<optimized out>, this=0x55ccb5f5b3b0) at ../../include/QtQmlModels/5.15.2/QtQmlModels/private/../../../../../../src/qmlmodels/qqmladaptormodel_p.h:142
#12 QQmlDelegateModelPrivate::variantValue (this=<optimized out>, group=<optimized out>, index=index@entry=0, name=...) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qmlmodels/qqmldelegatemodel.cpp:1376
#13 0x00007fafcd90d221 in QQmlDelegateModel::variantValue (this=this@entry=0x55ccb64dfda0, index=index@entry=0, role=...) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qmlmodels/qqmldelegatemodel.cpp:1393
#14 0x00007fafcaddc35c in QQuickComboBoxDelegateModel::variantValue (this=0x55ccb64dfda0, index=0, role=...) at /usr/src/debug/libqt5-qtquickcontrols2-5.15.2+kde10-1.2.x86_64/src/quicktemplates2/qquickcombobox.cpp:212
#15 0x00007fafcadd9f39 in QQmlInstanceModel::stringValue (role=..., index=0, this=<optimized out>) at /usr/include/qt5/QtQmlModels/5.15.2/QtQmlModels/private/qqmlobjectmodel_p.h:90
#16 QQuickComboBox::textAt (this=<optimized out>, index=0) at /usr/src/debug/libqt5-qtquickcontrols2-5.15.2+kde10-1.2.x86_64/src/quicktemplates2/qquickcombobox.cpp:1612
#17 0x00007fafcae58fdf in QQuickComboBox::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=0x7fff55367f50) at .moc/moc_qquickcombobox_p.cpp:409
#18 0x00007fafcae5b05b in QQuickComboBox::qt_metacall (this=0x55ccb77b2180, _c=QMetaObject::InvokeMetaMethod, _id=31, _a=0x7fff55367f50) at .moc/moc_qquickcombobox_p.cpp:728
#19 0x00007fafcf1411cd in QQmlObjectOrGadget::metacall (this=this@entry=0x7fff553681e0, type=type@entry=QMetaObject::InvokeMetaMethod, index=<optimized out>, index@entry=109, argv=<optimized out>) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qml/qml/qqmlobjectorgadget.cpp:51
#20 0x00007fafcf0201f0 in CallMethod (callType=<optimized out>, callArgs=0x2, engine=<optimized out>, argTypes=<optimized out>, argCount=<optimized out>, returnType=<optimized out>, index=<optimized out>, object=...) at /usr/include/qt5/QtCore/qvarlengtharray.h:189
#21 CallPrecise (object=..., data=..., engine=engine@entry=0x55ccb78ba640, callArgs=callArgs@entry=0x7faf333c05e8, callType=callType@entry=QMetaObject::InvokeMetaMethod) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qml/jsruntime/qv4qobjectwrapper.cpp:1569
#22 0x00007fafcf021fdb in CallOverloaded (callType=<optimized out>, propertyCache=<optimized out>, callArgs=<optimized out>, engine=<optimized out>, data=..., object=...) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qml/jsruntime/qv4qobjectwrapper.cpp:1645
#23 QV4::QObjectMethod::callInternal (this=<optimized out>, thisObject=<optimized out>, argv=<optimized out>, argc=<optimized out>) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qml/jsruntime/qv4qobjectwrapper.cpp:2133
#24 0x00007fafcf0504aa in QV4::FunctionObject::call (argc=1, argv=0x7faf333c0540, thisObject=0x7faf333c0598, this=0x7fff55368318) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qml/jsruntime/qv4functionobject_p.h:202
#25 QV4::Runtime::CallPropertyLookup::call (engine=0x55ccb78ba640, base=..., index=<optimized out>, argv=0x7faf333c0540, argc=1) at /usr/src/debug/libqt5-qtdeclarative-5.15.2+kde43-1.2.x86_64/src/qml/jsruntime/qv4runtime.cpp:1460
#26 0x00007faf5059c294 in ?? ()
#27 0x0000000000000000 in ?? ()
```


SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20220304
KDE Plasma Version: 5.24.2
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.16.11-1-default (64-bit)
Graphics Platform: Wayland
Comment 1 postix 2022-03-07 12:14:44 UTC
Created attachment 147346 [details]
Stracktrace (bt full)
Comment 2 Aleix Pol 2022-03-08 03:10:07 UTC
I don't really see what is broken with this.
How did you open system settings? Can you run it on a terminal and see if you get any debug output?
Comment 3 postix 2022-03-08 12:22:42 UTC
(In reply to Aleix Pol from comment #2)
> I don't really see what is broken with this.
> How did you open system settings? Can you run it on a terminal and see if
> you get any debug output?

I now believe it's the same bug as in #449849, as it indeed crashes when I open the tab a second time, but with a different stacktrace.
What I did under Wayland:

1) Opened systemsettings (via kickoff or terminal)
2) Filtered the list `tablet` and opened the tablet tab
3) (Applied) changed the active screen where the tablet shall work
4) Changed the tabs in the filtered list and finally went back to the `tablet` tab, where it crashed.


Here's the terminal output:

```
$ systemsettings5 
QQmlEngine::setContextForObject(): Object already has a QQmlContext
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qml: The item SubCategoryPage_QMLTYPE_114(0x55fdd3126470) is already in the PageRow
QQmlEngine::setContextForObject(): Object already has a QQmlContext
qml: The item SubCategoryPage_QMLTYPE_114(0x55fdd3126470) is already in the PageRow
QQmlEngine::setContextForObject(): Object already has a QQmlContext
qml: Configuration of device '1 : Logitech K400 Plus' opened
qml: The item SubCategoryPage_QMLTYPE_114(0x55fdd3126470) is already in the PageRow
qrc:/libinput/main.qml:31: TypeError: Cannot read property 'deviceCount' of null
QQmlEngine::setContextForObject(): Object already has a QQmlContext
KCrash: Application 'systemsettings' crashing...
QSocketNotifier: Invalid socket 12 and type 'Read', disabling...
KCrash: Attempting to start /usr/lib64/libexec/drkonqi
kf5idletime_kwayland: This plugin does not support polling idle time
fish: Job 1, 'systemsettings5' has stopped
```
Comment 4 Nate Graham 2022-04-21 14:31:07 UTC
*** Bug 452809 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2022-05-11 13:50:29 UTC
*** Bug 453635 has been marked as a duplicate of this bug. ***
Comment 6 Bug Janitor Service 2022-06-30 17:17:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1014
Comment 7 Nicolas Fella 2022-06-30 23:40:24 UTC
Git commit 813aeeb76c2ec1bb224421be357c0020c1a4099b by Nicolas Fella.
Committed on 30/06/2022 at 23:18.
Pushed by nicolasfella into branch 'master'.

[kcms/tablet] Fix crash when opening KCM for the second time

DevicesModel is a global singleton, so it is still alive by the time we open the KCM for the second time

However, the model is not initialized a second time, so no devices are loaded and any attempt to access data will crash

To avoid this have the model as a member of the KCM class so it gets properly destroyed when the KCM is closed and recreated when opened again

M  +0    -6    kcms/tablet/devicesmodel.cpp
M  +0    -1    kcms/tablet/devicesmodel.h
M  +12   -10   kcms/tablet/kcmtablet.cpp
M  +8    -0    kcms/tablet/kcmtablet.h
M  +2    -2    kcms/tablet/package/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/commit/813aeeb76c2ec1bb224421be357c0020c1a4099b
Comment 8 Nicolas Fella 2022-06-30 23:42:31 UTC
Git commit c6b50001166dbf69ee5d3c00283adffcb6219370 by Nicolas Fella.
Committed on 30/06/2022 at 23:40.
Pushed by nicolasfella into branch 'Plasma/5.25'.

[kcms/tablet] Fix crash when opening KCM for the second time

DevicesModel is a global singleton, so it is still alive by the time we open the KCM for the second time

However, the model is not initialized a second time, so no devices are loaded and any attempt to access data will crash

To avoid this have the model as a member of the KCM class so it gets properly destroyed when the KCM is closed and recreated when opened again
(cherry picked from commit 813aeeb76c2ec1bb224421be357c0020c1a4099b)

M  +0    -6    kcms/tablet/devicesmodel.cpp
M  +0    -1    kcms/tablet/devicesmodel.h
M  +12   -10   kcms/tablet/kcmtablet.cpp
M  +8    -0    kcms/tablet/kcmtablet.h
M  +2    -2    kcms/tablet/package/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/commit/c6b50001166dbf69ee5d3c00283adffcb6219370
Comment 9 Nicolas Fella 2022-06-30 23:47:44 UTC
Git commit 2a8d51a4ea4ed612829ac5ef0ce08df34d5b5518 by Nicolas Fella.
Committed on 30/06/2022 at 23:42.
Pushed by nicolasfella into branch 'Plasma/5.24'.

[kcms/tablet] Fix crash when opening KCM for the second time

DevicesModel is a global singleton, so it is still alive by the time we open the KCM for the second time

However, the model is not initialized a second time, so no devices are loaded and any attempt to access data will crash

To avoid this have the model as a member of the KCM class so it gets properly destroyed when the KCM is closed and recreated when opened again
(cherry picked from commit 813aeeb76c2ec1bb224421be357c0020c1a4099b)

M  +0    -6    kcms/tablet/devicesmodel.cpp
M  +0    -1    kcms/tablet/devicesmodel.h
M  +12   -10   kcms/tablet/kcmtablet.cpp
M  +8    -0    kcms/tablet/kcmtablet.h
M  +2    -2    kcms/tablet/package/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/commit/2a8d51a4ea4ed612829ac5ef0ce08df34d5b5518
Comment 10 Antonio Rojas 2022-07-01 13:48:26 UTC
*** Bug 449849 has been marked as a duplicate of this bug. ***