Bug 508555

Summary: Random KWin crash in KWin::SurfaceItemWayland::~SurfaceItemWayland() when a window pops up
Product: [Plasma] kwin Reporter: midnightcarnival
Component: generic-crashAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: crash CC: kdedev, nate
Priority: NOR Keywords: drkonqi
Version First Reported In: 6.4.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=510066
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report: https://crash-reports.kde.org/organizations/kde/issues/238585/events/321d2157d53a4373aeb08c9ba7c2e303/
Attachments: New crash information added by DrKonqi

Description midnightcarnival 2025-08-21 13:15:53 UTC
Application: kwin_wayland (6.4.4)

ApplicationNotResponding [ANR]: false
Qt Version: 6.9.1
Frameworks Version: 6.17.0
Operating System: Linux 6.16.1-1-cachyos x86_64
Windowing System: Wayland
Distribution: "Arch Linux"
DrKonqi: 6.4.4 [CoredumpBackend]

-- Information about the crash:
I noticed that recently, when any window pops up, KWin will have a small chance to crash, no matter whether the window uses X11 or Wayland.

Currently this error was triggered by these actions:
- Open Steam's window via the tray
- Open a new systemsettings window using the hotkey
- Click "Open Link in New Window" in firefox, or drag off an existing Tab to create a new firefox window

By the `small chance`, sometimes it crashes multiple times in a few hours, and sometimes the whole day without a crash, so I don't have an idea on how to reproduce it stably, sorry!

The crash can be reproduced sometimes.

-- Backtrace (Reduced):
#5  std::__atomic_base<QObject*>::load (this=0x122, __m=std::memory_order_relaxed) at /usr/include/c++/15.1.1/bits/atomic_base.h:828
#6  std::atomic<QObject*>::load (this=0x122, __m=std::memory_order_relaxed) at /usr/include/c++/15.1.1/atomic:587
#7  QAtomicOps<QObject*>::loadRelaxed<QObject*> (_q_value=<error reading variable: Cannot access memory at address 0x122>) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qatomic_cxx11.h:202
#8  QBasicAtomicPointer<QObject>::loadRelaxed (this=0x122) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qbasicatomic.h:170
#9  QObjectPrivate::isSignalConnected (this=this@entry=0x5618bd585900, signalIndex=signalIndex@entry=0, checkDeclarative=checkDeclarative@entry=true) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:440
#10 0x00007f11edbbfbc3 in QObject::~QObject (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:1041
#11 0x00007f11f0718dc3 in KWin::SurfaceItemWayland::~SurfaceItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/surfaceitem_wayland.h:25
#12 KWin::SurfaceItemWayland::~SurfaceItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/surfaceitem_wayland.h:25
#13 0x00007f11f072e806 in std::default_delete<KWin::SurfaceItem>::operator() (this=<optimized out>, __ptr=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:93
#14 std::unique_ptr<KWin::SurfaceItem, std::default_delete<KWin::SurfaceItem> >::~unique_ptr (this=<optimized out>, this=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:399
#15 KWin::WindowItem::~WindowItem (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.cpp:70
#16 0x00007f11f072e8c4 in KWin::WindowItemWayland::~WindowItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.h:115
#17 KWin::WindowItemWayland::~WindowItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.h:115
#18 0x00007f11f07d0ff1 in std::default_delete<KWin::WindowItem>::operator() (this=<optimized out>, __ptr=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:87
#19 std::unique_ptr<KWin::WindowItem, std::default_delete<KWin::WindowItem> >::~unique_ptr (this=<optimized out>, this=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:399
#20 KWin::Window::~Window (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/window.cpp:104
#5  std::__atomic_base<QObject*>::load (this=0x122, __m=std::memory_order_relaxed) at /usr/include/c++/15.1.1/bits/atomic_base.h:828
#6  std::atomic<QObject*>::load (this=0x122, __m=std::memory_order_relaxed) at /usr/include/c++/15.1.1/atomic:587
#7  QAtomicOps<QObject*>::loadRelaxed<QObject*> (_q_value=<error reading variable: Cannot access memory at address 0x122>) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qatomic_cxx11.h:202
#8  QBasicAtomicPointer<QObject>::loadRelaxed (this=0x122) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qbasicatomic.h:170
#9  QObjectPrivate::isSignalConnected (this=this@entry=0x5618bd585900, signalIndex=signalIndex@entry=0, checkDeclarative=checkDeclarative@entry=true) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:440
#10 0x00007f11edbbfbc3 in QObject::~QObject (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:1041
#11 0x00007f11f0718dc3 in KWin::SurfaceItemWayland::~SurfaceItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/surfaceitem_wayland.h:25
#12 KWin::SurfaceItemWayland::~SurfaceItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/surfaceitem_wayland.h:25
#13 0x00007f11f072e806 in std::default_delete<KWin::SurfaceItem>::operator() (this=<optimized out>, __ptr=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:93
#14 std::unique_ptr<KWin::SurfaceItem, std::default_delete<KWin::SurfaceItem> >::~unique_ptr (this=<optimized out>, this=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:399
#15 KWin::WindowItem::~WindowItem (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.cpp:70
#16 0x00007f11f072e8c4 in KWin::WindowItemWayland::~WindowItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.h:115
#17 KWin::WindowItemWayland::~WindowItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.h:115
#18 0x00007f11f07d0ff1 in std::default_delete<KWin::WindowItem>::operator() (this=<optimized out>, __ptr=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:87
#19 std::unique_ptr<KWin::WindowItem, std::default_delete<KWin::WindowItem> >::~unique_ptr (this=<optimized out>, this=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:399
#20 KWin::Window::~Window (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/window.cpp:104


Reported using DrKonqi
Comment 1 midnightcarnival 2025-08-21 13:15:55 UTC
Created attachment 184311 [details]
New crash information added by DrKonqi

DrKonqi auto-attaching complete backtrace.
Comment 2 TraceyC 2025-08-21 22:14:44 UTC
Searchable backtrace


Thread 1 (Thread 0x7f11e794aa40 (LWP 211018)):
[KCrash Handler]
#5  std::__atomic_base<QObject*>::load (this=0x122, __m=std::memory_order_relaxed) at /usr/include/c++/15.1.1/bits/atomic_base.h:828
#6  std::atomic<QObject*>::load (this=0x122, __m=std::memory_order_relaxed) at /usr/include/c++/15.1.1/atomic:587
#7  QAtomicOps<QObject*>::loadRelaxed<QObject*> (_q_value=<error reading variable: Cannot access memory at address 0x122>) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qatomic_cxx11.h:202
#8  QBasicAtomicPointer<QObject>::loadRelaxed (this=0x122) at /usr/src/debug/qt6-base/qtbase/src/corelib/thread/qbasicatomic.h:170
#9  QObjectPrivate::isSignalConnected (this=this@entry=0x5618bd585900, signalIndex=signalIndex@entry=0, checkDeclarative=checkDeclarative@entry=true) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:440
#10 0x00007f11edbbfbc3 in QObject::~QObject (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:1041
#11 0x00007f11f0718dc3 in KWin::SurfaceItemWayland::~SurfaceItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/surfaceitem_wayland.h:25
#12 KWin::SurfaceItemWayland::~SurfaceItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/surfaceitem_wayland.h:25
#13 0x00007f11f072e806 in std::default_delete<KWin::SurfaceItem>::operator() (this=<optimized out>, __ptr=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:93
#14 std::unique_ptr<KWin::SurfaceItem, std::default_delete<KWin::SurfaceItem> >::~unique_ptr (this=<optimized out>, this=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:399
#15 KWin::WindowItem::~WindowItem (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.cpp:70
#16 0x00007f11f072e8c4 in KWin::WindowItemWayland::~WindowItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.h:115
#17 KWin::WindowItemWayland::~WindowItemWayland (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/windowitem.h:115
#18 0x00007f11f07d0ff1 in std::default_delete<KWin::WindowItem>::operator() (this=<optimized out>, __ptr=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:87
#19 std::unique_ptr<KWin::WindowItem, std::default_delete<KWin::WindowItem> >::~unique_ptr (this=<optimized out>, this=<optimized out>) at /usr/include/c++/15.1.1/bits/unique_ptr.h:399
#20 KWin::Window::~Window (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/window.cpp:104
#21 0x00007f11f0818725 in KWin::XdgToplevelWindow::~XdgToplevelWindow (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/xdgshellwindow.cpp:512
#22 0x00007f11f05f6b0e in KWin::EffectWindowDeletedRef::~EffectWindowDeletedRef (this=<optimized out>, this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/effect/effectwindow.h:872
#23 std::destroy_at<KWin::EffectWindowDeletedRef> (__location=0x5618bc6b2ed8) at /usr/include/c++/15.1.1/bits/stl_construct.h:88
#24 std::_Destroy<KWin::EffectWindowDeletedRef> (__pointer=0x5618bc6b2ed8) at /usr/include/c++/15.1.1/bits/stl_construct.h:164
#25 std::_Destroy<KWin::EffectWindowDeletedRef*> (__first=0x5618bc6b2ed8, __last=0x5618bc6b2ee0) at /usr/include/c++/15.1.1/bits/stl_construct.h:212
#26 std::_Destroy<KWin::EffectWindowDeletedRef*, KWin::EffectWindowDeletedRef> (__first=0x5618bc6b2ed0, __last=0x5618bc6b2ee0) at /usr/include/c++/15.1.1/bits/alloc_traits.h:1045
#27 std::vector<KWin::EffectWindowDeletedRef, std::allocator<KWin::EffectWindowDeletedRef> >::~vector (this=<optimized out>, this=<optimized out>) at /usr/include/c++/15.1.1/bits/stl_vector.h:802
#28 KWin::AnimationEffect::postPaintScreen (this=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/effect/animationeffect.cpp:711
#29 0x00007f11f05fa1ec in KWin::EffectsHandler::postPaintScreen (this=0x5618bc66e130) at /usr/src/debug/kwin/kwin-6.4.4/src/effect/effecthandler.cpp:373
#30 0x00007f11f05fa1ec in KWin::EffectsHandler::postPaintScreen (this=0x5618bc66e130) at /usr/src/debug/kwin/kwin-6.4.4/src/effect/effecthandler.cpp:373
#31 0x00007f11f05fa1ec in KWin::EffectsHandler::postPaintScreen (this=0x5618bc66e130) at /usr/src/debug/kwin/kwin-6.4.4/src/effect/effecthandler.cpp:373
#32 0x00007f11f073c68a in KWin::WorkspaceScene::postPaint (this=0x5618bc968000) at /usr/src/debug/kwin/kwin-6.4.4/src/scene/workspacescene.cpp:395
#33 0x00007f11f057a998 in KWin::Compositor::postPaintPass (this=0x5618badcbb60, layer=0x5618bc96c180) at /usr/src/debug/kwin/kwin-6.4.4/src/compositor.cpp:151
#34 0x00007f11f05857ee in KWin::Compositor::composite (this=0x5618badcbb60, renderLoop=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/compositor.cpp:558
#35 0x00007f11edbd37ef in QtPrivate::QSlotObjectBase::call (this=<optimized out>, r=<optimized out>, a=<optimized out>, this=<optimized out>, r=<optimized out>, a=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs_impl.h:461
#36 doActivate<false> (sender=<optimized out>, signal_index=<optimized out>, argv=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:4146
#37 0x00007f11f059ec1b in QMetaObject::activate<void, KWin::RenderLoop*> (sender=<optimized out>, mo=<optimized out>, local_signal_index=2, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs.h:306
#38 KWin::RenderLoop::frameRequested (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_renderloop.cpp:171
#39 0x00007f11edbd37ef in QtPrivate::QSlotObjectBase::call (this=<optimized out>, r=<optimized out>, a=<optimized out>, this=<optimized out>, r=<optimized out>, a=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs_impl.h:461
#40 doActivate<false> (sender=<optimized out>, signal_index=<optimized out>, argv=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:4146
#41 0x00007f11edbe0abf in QMetaObject::activate<void, QTimer::QPrivateSignal> (sender=<optimized out>, mo=<optimized out>, local_signal_index=0, ret=0x0) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs.h:306
#42 QTimer::timeout (this=<optimized out>, _t1=...) at /usr/src/debug/qt6-base/build/src/corelib/Core_autogen/include/moc_qtimer.cpp:182
#43 QTimer::timerEvent (e=<optimized out>, this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qtimer.cpp:285
#44 QTimer::timerEvent (this=<optimized out>, e=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qtimer.cpp:279
#45 0x00007f11edbc0dd6 in QObject::event (this=<optimized out>, e=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:1406
#46 0x00007f11eed01c70 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5618bad22a30, e=0x7ffd5ab34a20) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3303
#47 0x00007f11edb68118 in QCoreApplication::notifyInternal2 (receiver=0x5618bad22a30, event=0x7ffd5ab34a20) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1106
#48 0x00007f11edd1bc6f in QCoreApplication::sendEvent (receiver=<optimized out>, event=0x7ffd5ab34a20) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1546
#49 QTimerInfoList::activateTimers (this=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qtimerinfo_unix.cpp:426
#50 0x00007f11edd27129 in QEventDispatcherUNIXPrivate::activateTimers (this=0x5618bab43920) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp:199
#51 QEventDispatcherUNIX::processEvents (this=<optimized out>, flags=..., flags@entry=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_unix.cpp:475
#52 0x00007f11ee91ad33 in QUnixEventDispatcherQPA::processEvents (this=<optimized out>, flags=...) at /usr/src/debug/qt6-base/qtbase/src/gui/platform/unix/qunixeventdispatcher.cpp:27
#53 0x00007f11edb744b6 in QEventLoop::processEvents (this=0x7ffd5ab34c10, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:104
#54 QEventLoop::exec (this=0x7ffd5ab34c10, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:186
#55 0x00007f11edb6c7c1 in QCoreApplication::exec () at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1449
#56 0x00007f11eecfc66a in QApplication::exec () at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:2570
#57 0x00005618819fbd26 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kwin/kwin-6.4.4/src/main_wayland.cpp:635