Bug 468694

Summary: Spectacle crashes in QWindowSystemInterface::handleScreenRemoved() when screen configuration changes
Product: [Applications] Spectacle Reporter: Jure Repinc <jlp>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED FIXED    
Severity: crash CC: aalsing, asturm, boredsquirrel, catboy70, cyrond, david2005thomas, fkwilcz2, holdenrf2021, jan.hegner, kde, martin-kokos, mippo9, nate, noahadvs, oper.kh, postix
Priority: HI Keywords: drkonqi
Version: 23.03.90   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=444386
https://bugs.kde.org/show_bug.cgi?id=489443
https://bugs.kde.org/show_bug.cgi?id=496254
Latest Commit: Version Fixed In: 23.08
Sentry Crash Report:

Description Jure Repinc 2023-04-19 22:08:52 UTC
Application: spectacle (23.03.90)

Qt Version: 5.15.8
Frameworks Version: 5.105.0
Operating System: Linux 6.2.10-1-default x86_64
Windowing System: Wayland
Distribution: "openSUSE Tumbleweed"
DrKonqi: 5.27.4 [KCrashBackend]

-- Information about the crash:
Steps to reproduce:
1. Press PrtScr to open Spectacle
2. Disconect/connect external screens

Expected result:
After reconfigaration Spectacle should continue runing

Actual result:
Spectacle crashes

The crash can be reproduced every time.

-- Backtrace:
Application: Spectacle (spectacle), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  0x000056189b190615 in std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)>::~unique_ptr (this=<optimized out>, this=<optimized out>) at /usr/include/c++/13/bits/unique_ptr.h:404
#7  std::__new_allocator<std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)> >::destroy<std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)> > (__p=<optimized out>, this=<optimized out>) at /usr/include/c++/13/bits/new_allocator.h:194
#8  std::allocator_traits<std::allocator<std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)> > >::destroy<std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)> > (__p=<optimized out>, __a=...) at /usr/include/c++/13/bits/alloc_traits.h:557
#9  std::vector<std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)>, std::allocator<std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)> > >::_M_erase (__position=non-dereferenceable iterator for std::vector, this=0x7ffcd9342778) at /usr/include/c++/13/bits/vector.tcc:187
#10 std::vector<std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)>, std::allocator<std::unique_ptr<CaptureWindow, void (*)(SpectacleWindow*)> > >::erase (__position=..., this=0x7ffcd9342778) at /usr/include/c++/13/bits/stl_vector.h:1530
#11 operator() (screen=<optimized out>, __closure=<optimized out>) at /usr/src/debug/spectacle-23.03.90/src/SpectacleCore.cpp:213
#12 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QScreen*>, void, SpectacleCore::SpectacleCore(QObject*)::<lambda(QScreen*)> >::call (arg=<optimized out>, f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#13 QtPrivate::Functor<SpectacleCore::SpectacleCore(QObject*)::<lambda(QScreen*)>, 1>::call<QtPrivate::List<QScreen*>, void> (arg=<optimized out>, f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#14 QtPrivate::QFunctorSlotObject<SpectacleCore::SpectacleCore(QObject*)::<lambda(QScreen*)>, 1, QtPrivate::List<QScreen*>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:443
#15 0x00007f56a2d25152 in QtPrivate::QSlotObjectBase::call (a=0x7ffcd9341cd0, r=0x7ffcd9342700, this=0x56189b7d0fb0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#16 doActivate<false> (sender=0x7ffcd93426b0, signal_index=10, argv=0x7ffcd9341cd0) at kernel/qobject.cpp:3923
#17 0x00007f56a2d1dd4f in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7f56a3715fc0, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7ffcd9341cd0) at kernel/qobject.cpp:3983
#18 0x00007f56a316e8c2 in QGuiApplication::screenRemoved (this=<optimized out>, _t1=<optimized out>, _t1@entry=0x56189b350e40) at .moc/moc_qguiapplication.cpp:396
#19 0x00007f56a31a5f18 in QScreen::~QScreen (this=0x56189b350e40, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:116
#20 0x00007f56a31a6089 in QScreen::~QScreen (this=0x56189b350e40, __in_chrg=<optimized out>) at kernel/qscreen.cpp:178
#21 0x00007f56a314f217 in QWindowSystemInterface::handleScreenRemoved (platformScreen=0x56189b392c00) at kernel/qwindowsysteminterface.cpp:844
#22 0x00007f56a4daabf2 in QtWaylandClient::QWaylandDisplay::registry_global_remove(unsigned int) () from /lib64/libQt5WaylandClient.so.5
#23 0x00007f56a43b48d2 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#24 0x00007f56a43b124f in ffi_call_int (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>) at ../src/x86/ffi64.c:673
#25 0x00007f56a43b3e96 in ffi_call (cif=cif@entry=0x7ffcd9341fb0, fn=<optimized out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7ffcd9342080) at ../src/x86/ffi64.c:710
#26 0x00007f56a5431a23 in wl_closure_invoke (closure=closure@entry=0x7f5684005370, target=<optimized out>, target@entry=0x56189b397800, opcode=opcode@entry=1, data=<optimized out>, flags=1) at ../src/connection.c:1025
#27 0x00007f56a54321b3 in dispatch_event (display=display@entry=0x56189b3976b0, queue=0x56189b397780) at ../src/wayland-client.c:1595
#28 0x00007f56a5432374 in dispatch_queue (queue=0x56189b397780, display=0x56189b3976b0) at ../src/wayland-client.c:1741
#29 wl_display_dispatch_queue_pending (display=0x56189b3976b0, queue=0x56189b397780) at ../src/wayland-client.c:1983
#30 0x00007f56a4da7a02 in QtWaylandClient::QWaylandDisplay::flushRequests() () from /lib64/libQt5WaylandClient.so.5
#31 0x00007f56a2d18b70 in QObject::event (this=0x56189b393260, e=0x7f568c002510) at kernel/qobject.cpp:1347
#32 0x00007f56a45a51ae in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x56189b393260, e=0x7f568c002510) at kernel/qapplication.cpp:3640
#33 0x00007f56a2cec898 in QCoreApplication::notifyInternal2 (receiver=0x56189b393260, event=0x7f568c002510) at kernel/qcoreapplication.cpp:1064
#34 0x00007f56a2cefe91 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x56189b38a230) at kernel/qcoreapplication.cpp:1821
#35 0x00007f56a2d46633 in postEventSourceDispatch (s=0x56189b3c8e90) at kernel/qeventdispatcher_glib.cpp:277
#36 0x00007f56a0848f96 in g_main_dispatch (context=0x7f5694000ee0) at ../glib/gmain.c:3460
#37 g_main_context_dispatch (context=context@entry=0x7f5694000ee0) at ../glib/gmain.c:4200
#38 0x00007f56a0849358 in g_main_context_iterate (context=context@entry=0x7f5694000ee0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4276
#39 0x00007f56a08493ec in g_main_context_iteration (context=0x7f5694000ee0, may_block=1) at ../glib/gmain.c:4343
#40 0x00007f56a2d45e46 in QEventDispatcherGlib::processEvents (this=0x56189b34fc70, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#41 0x00007f56a2ceb32b in QEventLoop::exec (this=this@entry=0x7ffcd93425d0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#42 0x00007f56a2cf37c0 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#43 0x00007f56a316fe0c in QGuiApplication::exec () at kernel/qguiapplication.cpp:1870
#44 0x00007f56a45a5125 in QApplication::exec () at kernel/qapplication.cpp:2832
#45 0x000056189b171b26 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/spectacle-23.03.90/src/Main.cpp:107
[Inferior 1 (process 22916) detached]

Reported using DrKonqi
Comment 1 postix 2023-05-23 19:56:41 UTC

*** This bug has been marked as a duplicate of bug 469527 ***
Comment 2 Nate Graham 2023-08-11 17:02:15 UTC
Fixed by Albert Astals Cid for Spectacle 23.08.1 with https://invent.kde.org/graphics/spectacle/-/commit/f87a841fcd4bc9ab3ea3efc65e1696fbb38788ac!
Comment 3 Nate Graham 2023-08-11 17:02:24 UTC
*** Bug 469311 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2023-08-11 17:02:28 UTC
*** Bug 469952 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2023-08-11 17:02:32 UTC
*** Bug 470009 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2023-08-11 17:02:48 UTC
*** Bug 471346 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2023-08-11 17:02:59 UTC
*** Bug 472011 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2023-08-11 17:03:09 UTC
*** Bug 473072 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2023-08-11 17:03:19 UTC
*** Bug 473114 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2023-08-11 17:04:02 UTC
*** Bug 469527 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2023-08-11 22:00:43 UTC
*** Bug 473293 has been marked as a duplicate of this bug. ***
Comment 12 Andreas Sturmlechner 2023-08-12 19:22:30 UTC
(In reply to Nate Graham from comment #2)
> Fixed by Albert Astals Cid for Spectacle 23.08.1 with
> https://invent.kde.org/graphics/spectacle/-/commit/
> f87a841fcd4bc9ab3ea3efc65e1696fbb38788ac!
Wouldn't that be fixed in 23.08.0 already?
Comment 13 Nate Graham 2023-08-12 19:26:34 UTC
Per https://community.kde.org/Schedules/KDE_Gear_23.08_Schedule#Thursday,_August_17,_2023:_23.08_Tagging, it looks like final tagging has indeed not happened yet, so you're right!
Comment 14 Nate Graham 2023-08-30 19:58:06 UTC
*** Bug 473931 has been marked as a duplicate of this bug. ***
Comment 15 Nate Graham 2023-08-31 15:04:06 UTC
*** Bug 473979 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2023-09-20 18:31:57 UTC
*** Bug 474733 has been marked as a duplicate of this bug. ***