Bug 441585

Summary: kded5 crashes in KWin::EffectQuickView::EffectQuickView
Product: [Plasma] kwin Reporter: Heiko Becker <heiko.becker>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: nate, sokann, XA_Hydra
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=443142
Latest Commit: Version Fixed In: 5.23
Sentry Crash Report:

Description Heiko Becker 2021-08-26 19:36:38 UTC
SUMMARY

(Not sure which component is most appropriate)

kded5 crashes almost instantly and very frequently in KWin::EffectQuickView::EffectQuickView, backtrace below. Looks like effects is null here and if I revert c79d7f56dd0eacfea761984b49a493f5a730401b kded5 starts working normally again.

This is on X11, running plasmashell with awesome set as KDEWM, not kwin.

STEPS TO REPRODUCE
1. start kded5, e.g. when starting Plasma

SOFTWARE/OS VERSIONS
KDE Plasma Version: current master
KDE Frameworks Version: current master
Qt Version: 5.12.2 + KDE patch collection

ADDITIONAL INFORMATION

Application: kded5 (kded5), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = 0x0}
[KCrash Handler]
#5  0x00007f18d9762a04 in KWin::EffectQuickView::EffectQuickView(QObject*, QWindow*, KWin::EffectQuickView::ExportMode) (this=0x55e8ead6e290, parent=<optimized out>, renderWindow=<optimized out>, exportMode=<optimized out>) at /var/tmp/paludis/build/kde-kwin-scm/work/kwin-scm/src/libkwineffects/kwineffectquickview.cpp:138
#6  0x00007f18d97dc8bf in Aurorae::Decoration::init() (this=0x55e8eab64b50) at /var/tmp/paludis/build/kde-kwin-scm/work/kwin-scm/src/plugins/kdecorations/aurorae/src/aurorae.cpp:316
#7  0x00007f18da0ced23 in KDecoration2::DummyDecorationBridge::DummyDecorationBridge(QString const&, QObject*) (this=this@entry=0x55e8eab622b0, decorationTheme=..., parent=parent@entry=0x0) at /var/tmp/paludis/build/kde-kde-gtk-config-scm/work/kde-gtk-config-scm/kded/kwin_bridge/dummydecorationbridge.cpp:59
#8  0x00007f18da0cddde in StandardDecorationPainter::StandardDecorationPainter(QString const&) (this=this@entry=0x55e8eab04030, themeName=...) at /var/tmp/paludis/build/kde-kde-gtk-config-scm/work/kde-gtk-config-scm/kded/kwin_bridge/standarddecorationpainter.cpp:11
#9  0x00007f18da0cd4e8 in DecorationPainter::fromThemeName(QString const&) (themeName=...) at /var/tmp/paludis/build/kde-kde-gtk-config-scm/work/kde-gtk-config-scm/kded/kwin_bridge/decorationpainter.cpp:24
#10 0x00007f18da0c50f8 in ConfigValueProvider::windowDecorationsButtonsImages() const (this=0x55e8eab3c010) at /var/tmp/paludis/build/kde-kde-gtk-config-scm/work/kde-gtk-config-scm/kded/configvalueprovider.cpp:192
#11 0x00007f18da0bd58a in GtkConfig::setWindowDecorationsAppearance() const (this=0x55e8eab3c470) at /usr/x86_64-pc-linux-gnu/include/qt5/QtCore/qscopedpointer.h:116
#12 GtkConfig::setWindowDecorationsAppearance() const (this=0x55e8eab3c470) at /var/tmp/paludis/build/kde-kde-gtk-config-scm/work/kde-gtk-config-scm/kded/gtkconfig.cpp:155
#13 0x00007f18da0be461 in GtkConfig::applyAllSettings() const (this=this@entry=0x55e8eab3c470) at /var/tmp/paludis/build/kde-kde-gtk-config-scm/work/kde-gtk-config-scm/kded/gtkconfig.cpp:201
#14 0x00007f18da0be93d in GtkConfig::GtkConfig(QObject*, QList<QVariant> const&) (this=0x55e8eab3c470, parent=<optimized out>) at /var/tmp/paludis/build/kde-kde-gtk-config-scm/work/kde-gtk-config-scm/kded/gtkconfig.cpp:39
#15 0x00007f18da0bf7ea in KPluginFactory::createInstance<GtkConfig, QObject>(QWidget*, QObject*, QList<QVariant> const&) (parentWidget=<optimized out>, parent=<optimized out>, args=...) at /usr/x86_64-pc-linux-gnu/include/KF5/KCoreAddons/kpluginfactory.h:806
#16 0x00007f18ed7109d2 in KPluginFactory::create(char const*, QWidget*, QObject*, QList<QVariant> const&, QString const&) (this=this@entry=0x55e8eab06f90, iface=0x7f18edf52260 <qt_meta_stringdata_KDEDModule+288> "KDEDModule", parentWidget=parentWidget@entry=0x0, parent=parent@entry=0x55e8ea8d2680, args=..., keyword=...) at /var/tmp/paludis/build/kde-frameworks-kcoreaddons-scm/work/kcoreaddons-scm/src/lib/plugin/kpluginfactory.cpp:212
#17 0x000055e8e99e8d31 in KPluginFactory::create<KDEDModule>(QObject*, QList<QVariant> const&) (args=..., parent=0x55e8ea8d2680, this=0x55e8eab06f90) at /usr/x86_64-pc-linux-gnu/include/KF5/KCoreAddons/kpluginfactory.h:853
#18 Kded::loadModule(KPluginMetaData const&, bool) (this=this@entry=0x55e8ea8d2680, module=..., onDemand=onDemand@entry=false) at /var/tmp/paludis/build/kde-frameworks-kded-scm/work/kded-scm/src/kded.cpp:369
#19 0x000055e8e99e9c49 in Kded::initModules() (this=this@entry=0x55e8ea8d2680) at /var/tmp/paludis/build/kde-frameworks-kded-scm/work/kded-scm/src/kded.cpp:242
#20 0x000055e8e99ea0b3 in Kded::recreateDone() (this=0x55e8ea8d2680) at /var/tmp/paludis/build/kde-frameworks-kded-scm/work/kded-scm/src/kded.cpp:521
#21 Kded::recreate(bool) (initial=true, this=0x55e8ea8d2680) at /var/tmp/paludis/build/kde-frameworks-kded-scm/work/kded-scm/src/kded.cpp:505
#22 Kded::recreate(bool) (this=0x55e8ea8d2680, initial=<optimized out>) at /var/tmp/paludis/build/kde-frameworks-kded-scm/work/kded-scm/src/kded.cpp:489
#23 0x000055e8e99e4109 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /var/tmp/paludis/build/kde-frameworks-kded-scm/work/kded-scm/src/kded.cpp:774
[Inferior 1 (process 39323) detached]
Comment 1 Bug Janitor Service 2021-09-22 09:25:11 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1448
Comment 2 Nate Graham 2021-09-22 18:35:56 UTC
*** Bug 442809 has been marked as a duplicate of this bug. ***
Comment 3 Vlad Zahorodnii 2021-09-23 06:33:25 UTC
Git commit 1b215e6c063f5bad18a09e247d2f18fade7dfdc8 by Vlad Zahorodnii.
Committed on 23/09/2021 at 06:28.
Pushed by vladz into branch 'master'.

libkwineffects: Avoid accessing effects in EffectQuickView

EffectQuickView is used by Aurorae. As long as Aurorae decorations are
rendered by kwin, it's not a problem. However, kde-gtk-config kded
module can also render them. This creates a problem. If effects object
is not created, accessing any of its getters or setters will result in a
segmentation fault.

This change rewrites the share context check so the effects object is
not accessed anymore.

One could argue that kde-gtk-config has to provide a dummy EffectsHandler
but it doesn't use effects and libkwineffects is not a dependency of
KDecoration2. So, providing a dummy EffectsHandler makes no sense.

In hindsight, we need to revisit the usage of EffectQuickView in Aurorae
as accessing the EffectsHandler in EffectQuickView is a totally valid
usecase and integration of QOpenGLContext.

M  +4    -3    src/libkwineffects/kwineffectquickview.cpp

https://invent.kde.org/plasma/kwin/commit/1b215e6c063f5bad18a09e247d2f18fade7dfdc8
Comment 4 Vlad Zahorodnii 2021-09-23 06:33:36 UTC
Git commit 65675140ff61e8a6ec5b7ab78c772084ce243484 by Vlad Zahorodnii.
Committed on 23/09/2021 at 06:33.
Pushed by vladz into branch 'Plasma/5.23'.

libkwineffects: Avoid accessing effects in EffectQuickView

EffectQuickView is used by Aurorae. As long as Aurorae decorations are
rendered by kwin, it's not a problem. However, kde-gtk-config kded
module can also render them. This creates a problem. If effects object
is not created, accessing any of its getters or setters will result in a
segmentation fault.

This change rewrites the share context check so the effects object is
not accessed anymore.

One could argue that kde-gtk-config has to provide a dummy EffectsHandler
but it doesn't use effects and libkwineffects is not a dependency of
KDecoration2. So, providing a dummy EffectsHandler makes no sense.

In hindsight, we need to revisit the usage of EffectQuickView in Aurorae
as accessing the EffectsHandler in EffectQuickView is a totally valid
usecase and integration of QOpenGLContext.


(cherry picked from commit 1b215e6c063f5bad18a09e247d2f18fade7dfdc8)

M  +4    -3    src/libkwineffects/kwineffectquickview.cpp

https://invent.kde.org/plasma/kwin/commit/65675140ff61e8a6ec5b7ab78c772084ce243484