Bug 442222

Summary: Kwin crashes in KWin::belongToSameGroup() in "Dim Inactive" effect when closing grouped app
Product: [Plasma] kwin Reporter: Linus Kardell <linus.kardell>
Component: effects-variousAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: davidincyberspace, k21gcy20j, karl, nate, slavomirr
Priority: NOR    
Version: 5.22.5   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=470061
Latest Commit: Version Fixed In: 5.27
Sentry Crash Report:

Description Linus Kardell 2021-09-09 12:06:02 UTC
STEPS TO REPRODUCE
1. Open two audio files in separate instances of Audacity
2. Close one of the Audacity windows
3. When asked whether to save, click no

OBSERVED RESULT
kwin crashes

SOFTWARE/OS VERSIONS
Qt Version: 5.15.2
Frameworks Version: 5.85.0
Kwin Version: 5.22.4 (not available in version box)
Operating System: Linux 5.13.12-2-default x86_64
Windowing System: X11
Distribution: "openSUSE Tumbleweed"
Graphics driver: Nvidia 470.57

ADDITIONAL INFORMATION

Backtrace:

Application: Kwin (kwin_x11), signal: Segmentation fault
Content of s_kcrashErrorMessage: [Current thread is 1 (Thread 0x7f1c955d0980 (LWP 4904))]
[KCrash Handler]
#6  0x00007f1c99095f51 in  () at /lib64/libkwin4_effect_builtins.so.1
#7  0x00007f1c99096ccb in  () at /lib64/libkwin4_effect_builtins.so.1
#8  0x00007f1c9ace77f3 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) () at /lib64/libkwin.so.5
#9  0x00007f1c9ace77f3 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) () at /lib64/libkwin.so.5
#10 0x00007f1c9ace77f3 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) () at /lib64/libkwin.so.5
#11 0x00007f1c9ad553be in KWin::Scene::paintWindow(KWin::Scene::Window*, int, QRegion const&, KWin::WindowQuadList const&) () at /lib64/libkwin.so.5
#12 0x00007f1c9ad57869 in KWin::Scene::paintSimpleScreen(int, QRegion const&) () at /lib64/libkwin.so.5
#13 0x00007f1c9ad51cbe in KWin::Scene::finalPaintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /lib64/libkwin.so.5
#14 0x00007f1c9ace7754 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /lib64/libkwin.so.5
#15 0x00007f1c9ace7754 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /lib64/libkwin.so.5
#16 0x00007f1c9ace7754 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /lib64/libkwin.so.5
#17 0x00007f1c9ace7754 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /lib64/libkwin.so.5
#18 0x00007f1c9ace7754 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) () at /lib64/libkwin.so.5
#19 0x00007f1c9ad54220 in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, KWin::RenderLoop*, QMatrix4x4 const&) () at /lib64/libkwin.so.5
#20 0x00007f1c7c1b2010 in  () at /usr/lib64/qt5/plugins/org.kde.kwin.scenes/KWinSceneOpenGL.so
#21 0x00007f1c9acb7308 in KWin::Compositor::composite(KWin::RenderLoop*) () at /lib64/libkwin.so.5
#22 0x00007f1c9acb772b in KWin::X11Compositor::composite(KWin::RenderLoop*) () at /lib64/libkwin.so.5
#23 0x00007f1c998e0fd3 in  () at /lib64/libQt5Core.so.5
#24 0x00007f1c9ac7cd92 in KWin::RenderLoop::frameRequested(KWin::RenderLoop*) () at /lib64/libkwin.so.5
#25 0x00007f1c9ad46f33 in KWin::RenderLoopPrivate::dispatch() () at /lib64/libkwin.so.5
#26 0x00007f1c998e0fd3 in  () at /lib64/libQt5Core.so.5
#27 0x00007f1c998e4e8a in QTimer::timeout(QTimer::QPrivateSignal) () at /lib64/libQt5Core.so.5
#28 0x00007f1c998d6e9f in QObject::event(QEvent*) () at /lib64/libQt5Core.so.5
#29 0x00007f1c9a47ea7f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#30 0x00007f1c998aa98a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#31 0x00007f1c999011fb in QTimerInfoList::activateTimers() () at /lib64/libQt5Core.so.5
#32 0x00007f1c998ff707 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#33 0x00007f1c936ac0ae in  () at /lib64/libQt5XcbQpa.so.5
#34 0x00007f1c998a938b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#35 0x00007f1c998b1670 in QCoreApplication::exec() () at /lib64/libQt5Core.so.5
#36 0x000055e92373dfb6 in  ()
#37 0x00007f1c99179b35 in __libc_start_main (main=0x55e92373dbb0, argc=3, argv=0x7ffcf3d83f48, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffcf3d83f38) at ../csu/libc-start.c:332
#38 0x000055e92373e51e in  ()
[Inferior 1 (process 4904) detached]

I installed the debuginfo packages for the files the crash manager listed, but that doesn't seem to have done anything, and the automatic installer fails.
Comment 1 Nate Graham 2021-09-09 17:47:40 UTC
Unfortunately the backtrace is incomplete and missing debug symbols that we need to figure out exactly what's going wrong:


#6  0x00007f1c99095f51 in  () at /lib64/libkwin4_effect_builtins.so.1
#7  0x00007f1c99096ccb in  () at /lib64/libkwin4_effect_builtins.so.1


Could you please install debug symbols for kwin, reproduce the crash, and attach a new symbolicated backtrace? See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Thanks!
Comment 2 Linus Kardell 2021-09-09 17:58:59 UTC
Apparently the reason installing the debuginfo didn't work earlier was because of a version mismatch as I hadn't updated in a while. After updating and doing it again I got this:

Application: Kwin (kwin_x11), signal: Segmentation fault
Content of s_kcrashErrorMessage: [Current thread is 1 (Thread 0x7f5da15d0980 (LWP 6623))]
[KCrash Handler]
#6  0x00007f5da50a3f51 in KWin::belongToSameGroup (w2=0x5654fdf239f0, w1=0x5654fe3c3190) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects/diminactive/diminactive.cpp:33
#7  KWin::DimInactiveEffect::canDimWindow(KWin::EffectWindow const*) const (this=0x5654fbb09020, w=0x5654fdf239f0) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects/diminactive/diminactive.cpp:179
#8  0x00007f5da50a4ccb in KWin::DimInactiveEffect::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) (this=this@entry=0x5654fbb09020, w=<optimized out>, w@entry=0x5654fdf239f0, mask=mask@entry=1, region=..., data=...) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects/diminactive/diminactive.cpp:124
#9  0x00007f5da6cf77e3 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) (this=0x5654fdd63120, w=0x5654fdf239f0, mask=1, region=<optimized out>, data=...) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:437
#10 0x00007f5da6cf77e3 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) (this=0x5654fdd63120, w=0x5654fdf239f0, mask=1, region=<optimized out>, data=...) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:437
#11 0x00007f5da6cf77e3 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion const&, KWin::WindowPaintData&) (this=0x5654fdd63120, w=0x5654fdf239f0, mask=1, region=<optimized out>, data=...) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:437
#12 0x00007f5da6d6539e in KWin::Scene::paintWindow(KWin::Scene::Window*, int, QRegion const&, KWin::WindowQuadList const&) (this=0x5654fbb42460, w=0x5654fdf23f10, mask=1, _region=<optimized out>, quads=...) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:2142
#13 0x00007f5da6d67849 in KWin::Scene::paintSimpleScreen(int, QRegion const&) (this=<optimized out>, orig_mask=<optimized out>, region=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/scene.cpp:432
#14 0x00007f5da6d61c9e in KWin::Scene::finalPaintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x5654fbb42460, mask=<optimized out>, region=<optimized out>, data=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/scene.cpp:231
#15 0x00007f5da6cf7744 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x5654fdd63120, mask=<optimized out>, region=<optimized out>, data=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:394
#16 0x00007f5da6cf7744 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x5654fdd63120, mask=<optimized out>, region=<optimized out>, data=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:394
#17 0x00007f5da6cf7744 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x5654fdd63120, mask=<optimized out>, region=<optimized out>, data=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:394
#18 0x00007f5da6cf7744 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x5654fdd63120, mask=<optimized out>, region=<optimized out>, data=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:394
#19 0x00007f5da6cf7744 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x5654fdd63120, mask=<optimized out>, region=<optimized out>, data=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/effects.cpp:394
#20 0x00007f5da6d64200 in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, KWin::RenderLoop*, QMatrix4x4 const&) (this=this@entry=0x5654fbb42460, mask=mask@entry=0x7ffe50240080, damage=..., repaint=..., updateRegion=updateRegion@entry=0x7ffe50240098, validRegion=validRegion@entry=0x7ffe50240090, renderLoop=0x5654fb9e2380, projection=...) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/scene.cpp:203
#21 0x00007f5d9c02f010 in KWin::SceneOpenGL::paint(int, QRegion const&, QList<KWin::Toplevel*> const&, KWin::RenderLoop*) (this=0x5654fbb42460, screenId=-1, damage=<optimized out>, toplevels=<optimized out>, renderLoop=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/plugins/scenes/opengl/scene_opengl.cpp:695
#22 0x00007f5da6cc7308 in KWin::Compositor::composite(KWin::RenderLoop*) (this=0x5654fba614a0, renderLoop=0x5654fb9e2380) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/composite.cpp:628
#23 0x00007f5da6cc772b in KWin::X11Compositor::composite(KWin::RenderLoop*) (this=0x5654fba614a0, renderLoop=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/composite.cpp:810
#24 0x00007f5da58ef033 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffe50240370, r=0x5654fba614a0, this=0x5654fbbd5ec0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#25 doActivate<false>(QObject*, int, void**) (sender=0x5654fb9e2380, signal_index=5, argv=0x7ffe50240370) at kernel/qobject.cpp:3886
#26 0x00007f5da58e84ff in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7f5da6eeb700 <KWin::RenderLoop::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7ffe50240370) at kernel/qobject.cpp:3946
#27 0x00007f5da6c8cd92 in KWin::RenderLoop::frameRequested(KWin::RenderLoop*) (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/build/src/kwin_autogen/EWIEGA46WW/moc_renderloop.cpp:206
#28 0x00007f5da6d56f53 in KWin::RenderLoopPrivate::dispatch() (this=0x5654fb8c1250) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/renderloop.cpp:162
#29 0x00007f5da58ef033 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffe50240490, r=0x5654fb9e2380, this=0x5654fb8a0630) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#30 doActivate<false>(QObject*, int, void**) (sender=0x5654fb8c1268, signal_index=3, argv=0x7ffe50240490) at kernel/qobject.cpp:3886
#31 0x00007f5da58e84ff in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7f5da5b8abe0 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffe50240490) at kernel/qobject.cpp:3946
#32 0x00007f5da58f2eea in QTimer::timeout(QTimer::QPrivateSignal) (this=<optimized out>, _t1=...) at .moc/moc_qtimer.cpp:205
#33 0x00007f5da58e4eff in QObject::event(QEvent*) (this=0x5654fb8c1268, e=0x7ffe50240610) at kernel/qobject.cpp:1336
#34 0x00007f5da648ea7f in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x5654fb8c1268, e=0x7ffe50240610) at kernel/qapplication.cpp:3632
#35 0x00007f5da58b89ea in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x5654fb8c1268, event=0x7ffe50240610) at kernel/qcoreapplication.cpp:1064
#36 0x00007f5da590f25b in QTimerInfoList::activateTimers() (this=this@entry=0x5654fb7db638) at kernel/qtimerinfo_unix.cpp:643
#37 0x00007f5da590ca1c in QEventDispatcherUNIXPrivate::activateTimers() (this=this@entry=0x5654fb7db5b0) at kernel/qeventdispatcher_unix.cpp:249
#38 0x00007f5da590d767 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x5654fb89f2d0, flags=...) at kernel/qeventdispatcher_unix.cpp:516
#39 0x00007f5d9f6ac0ae in QXcbUnixEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5654fb89f2d0, flags=...) at qxcbeventdispatcher.cpp:60
#40 0x00007f5da58b73eb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffe502407b0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#41 0x00007f5da58bf6d0 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#42 0x00007f5da5d0519c in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1867
#43 0x00007f5da648e9f5 in QApplication::exec() () at kernel/qapplication.cpp:2824
#44 0x00005654fb763fb6 in main(int, char**) (argc=<optimized out>, argv=0x7ffe50240a48) at /usr/src/debug/kwin5-5.22.5-1.1.x86_64/src/main_x11.cpp:479
[Inferior 1 (process 6623) detached]
Comment 3 Nate Graham 2021-09-09 18:15:20 UTC
Thanks, that's helpful. Now we can tell that the problem is caused by the Dim Inactive effect. As a workaround, are you able to stop the crash by disabling that effect?
Comment 4 Linus Kardell 2021-09-09 18:20:06 UTC
Yes, the crash does not happen if dim inactive is disabled.
Comment 5 Nate Graham 2021-09-09 18:24:06 UTC
Thanks for confirming.
Comment 6 Nate Graham 2021-11-12 22:58:34 UTC
*** Bug 445375 has been marked as a duplicate of this bug. ***
Comment 7 Linus Kardell 2021-12-21 15:48:56 UTC
I also sometimes get a crash in the same place if I switch activities back and forth a bunch of times in a row with super+tab.
Comment 8 Nate Graham 2022-02-07 05:09:40 UTC
*** Bug 449702 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2022-05-10 16:01:37 UTC
*** Bug 453626 has been marked as a duplicate of this bug. ***
Comment 10 Vlad Zahorodnii 2022-09-19 10:57:48 UTC
*** Bug 459380 has been marked as a duplicate of this bug. ***
Comment 11 Bug Janitor Service 2023-01-17 11:04:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3449
Comment 12 Vlad Zahorodnii 2023-01-17 19:57:33 UTC
Git commit d57be742ff5b9e94fb923f72f481090cf4896a3d by Vlad Zahorodnii.
Committed on 17/01/2023 at 18:41.
Pushed by vladz into branch 'master'.

effects/diminactive: Ensure that m_activeWindow is always reset

As the FIXME comment says, a window can be deleted without prior
windowClosed signal.

M  +3    -0    src/effects/diminactive/diminactive.cpp

https://invent.kde.org/plasma/kwin/commit/d57be742ff5b9e94fb923f72f481090cf4896a3d