lxqt / lxqt-qtplugin

LXQt Qt platform integration plugin
https://lxqt.github.io
GNU Lesser General Public License v2.1
24 stars 14 forks source link

kscreen_backend segfault in libQt6Widgets.so (kglobalacceld) #83

Closed Chiitoo closed 3 months ago

Chiitoo commented 3 months ago

I'm not sure where to go with this one: here, Qt, KDE, or other. : ]

I first noticed something was wrong when my 'alt-tab' was not working, and eventually found out 'kglobalacceld' wasn't running, and then I noticed it was occasionally crashing.

Later I found out I can make it happen on demand by changing the appearance settings.

This very well could just be me at this time.

Expected Behavior

No segmentation fault in QCoreApplication.

Current Behavior
[...]

fontStr_ =  "DejaVu Sans,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1"
style_ =  "Fusion"
font_ =  QFont(DejaVu Sans,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1)
fontStr_ =  "DejaVu Sans,10,-1,5,400,0,0,0,0,0,0,0,0,0,0,1"
style_ =  "Fusion"
font_ =  QFont(DejaVu Sans,10,-1,5,400,0,0,0,0,0,0,0,0,0,0,1)

[...]

Thread 1 "kglobalacceld" received signal SIGSEGV, Segmentation fault.
0x00007ffff4a88eca in QApplication::setFont (font=..., className=0x0) at /usr/src/debug/dev-qt/qtbase-6.6.3/qtbase-everywhere-src-6.6.3/src/widgets/kernel/qapplication.cpp:1374
1374                QCoreApplication::sendEvent(*it, &e);
#0  0x00007ffff4a88eca in QApplication::setFont (font=..., className=0x0) at /usr/src/debug/dev-qt/qtbase-6.6.3/qtbase-everywhere-src-6.6.3/src/widgets/kernel/qapplication.cpp:1374
#1  0x00007ffff14a97d1 in LXQtPlatformTheme::loadSettings (this=0x5555555e5af0) at /usr/src/debug/lxqt-base/lxqt-qtplugin-9999/lxqt-qtplugin-9999/src/lxqtplatformtheme.cpp:241
#2  0x00007ffff14a9bbf in LXQtPlatformTheme::onSettingsChanged (this=0x5555555e5af0) at /usr/src/debug/lxqt-base/lxqt-qtplugin-9999/lxqt-qtplugin-9999/src/lxqtplatformtheme.cpp:289
#3  0x00007ffff14addb7 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (LXQtPlatformTheme::*)()>::call(void (LXQtPlatformTheme::*)(), LXQtPlatformTheme*, void**) (f=(void (LXQtPlatformTheme::*)(LXQtPlatformTheme * const)) 0x7ffff14a9a9a <LXQtPlatformTheme::onSettingsChanged()>, o=0x5555555e5af0, arg=0x7fffffffbbf0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:145
#4  0x00007ffff14ad5ac in QtPrivate::FunctionPointer<void (LXQtPlatformTheme::*)()>::call<QtPrivate::List<>, void>(void (LXQtPlatformTheme::*)(), LXQtPlatformTheme*, void**) (f=(void (LXQtPlatformTheme::*)(LXQtPlatformTheme * const)) 0x7ffff14a9a9a <LXQtPlatformTheme::onSettingsChanged()>, o=0x5555555e5af0, arg=0x7fffffffbbf0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:182
#5  0x00007ffff14ad027 in QtPrivate::QCallableObject<void (LXQtPlatformTheme::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x5555556cbc70, r=0x5555555e5af0, a=0x7fffffffbbf0, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:520
#6  0x00007ffff6aaa9bd in QtPrivate::QSlotObjectBase::call (this=0x5555556cbc70, r=0x5555555e5af0, a=0x7fffffffbbf0) at /usr/src/debug/dev-qt/qtbase-6.6.3/qtbase-everywhere-src-6.6.3/src/corelib/kernel/qobjectdefs_impl.h:433
#7  0x00007ffff6bf5fa6 in doActivate<false> (sender=0x555555696ed0, signal_index=3, argv=0x7fffffffbbf0) at /usr/src/debug/dev-qt/qtbase-6.6.3/qtbase-everywhere-src-6.6.3/src/corelib/kernel/qobject.cpp:4039
#8  0x00007ffff6b8c3e1 in QMetaObject::activate (sender=0x555555696ed0, m=0x7ffff70ca720 <QFileSystemWatcher::staticMetaObject>, local_signal_index=0, argv=0x7fffffffbbf0) at /usr/src/debug/dev-qt/qtbase-6.6.3/qtbase-everywhere-src-6.6.3/src/corelib/kernel/qobject.cpp:4099
#9  0x00007ffff6939911 in QFileSystemWatcher::fileChanged (this=0x555555696ed0, _t1=..., _t2=...) at /usr/src/debug/dev-qt/qtbase-6.6.3/qtbase-everywhere-src-6.6.3_build/src/corelib/Core_autogen/include/moc_qfilesystemwatcher.cpp:212
#10 0x00007ffff69387ba in QFileSystemWatcherPrivate::_q_fileChanged (this=0x55555568f2f0, path=..., removed=true) at /usr/src/debug/dev-qt/qtbase-6.6.3/qtbase-everywhere-src-6.6.3/src/corelib/io/qfilesystemwatcher.cpp:115
#11 0x00007ffff6939637 in QFileSystemWatcher::qt_static_metacall (_o=0x555555696ed0, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fffffffbe80) at /usr/src/debug/dev-qt/qtbase-6.6.3/qtbase-everywhere-src-6.6.3_build/src/corelib/Core_autogen/include/moc_qfilesystemwatcher.cpp:155

[...]
Possible Solution

Code will need to be amended, though not sure in which project.

Steps to Reproduce (for bugs)
  1. Build the LXQt and required KDE components against Qt 6.
  2. Change the appearance settings (perhaps there are other settings that do this too).
  3. Apply settings.
Context

Loss of global hotkeys provided by KWin.

System Information

Thank you!

tsujan commented 3 months ago

The crash is in kglobalacceld, but it may be our fault. I have a wild guess; will make a PR later.

stefonarch commented 3 months ago

On wayland I can reproduce a similar thing when changing font, but I loose not all shortcuts, custom ones are working. No backtrace as it's intergrated in kwin somehow afaik.

EDIT: can't reproduce under X11, my missing alt+tab has another reason.

tsujan commented 3 months ago

@Chiitoo, @stefonarch Please check https://github.com/lxqt/lxqt-qtplugin/pull/84. I think this issue is old because I'd seen a similar crash with Qt5.

tsujan commented 3 months ago

Oh, and don't forget to restart kglobalacceld before testing.

stefonarch commented 3 months ago

Couldn't reproduce before because klobalacceld doesn't autostart. Got the same crash, the fix looks working fine but only after session restart.

Chiitoo commented 3 months ago

I had noticed my KWin shortcuts start go missing for a while now on qt5 as well, or well, alt-tab at least, which is pretty hard to miss.

They would always come back when I went to the KWin task switcher settings I believe it was, so maybe there was a crash in the background, and going to that menu restarted it for me.

The fix seems to have made the crash go away for me (interesting to see the fix too).

Thank you again!

tsujan commented 3 months ago

the fix looks working fine but only after session restart.

Because klobalacceld should "see" it.

The fix seems to have made the crash go away for me

We had a similar issue with QML apps years ago, and it was fixed exactly in the same way. Strange that we didn't generalize the fix in that time!