Bug 467593

Summary: Spectacle crashes in PipeWireRecordProduceThread::~PipeWireRecordProduceThread() when closed while recording the screen
Product: [Frameworks and Libraries] KPipeWire Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: agurenko, aleixpol, kde, nate, noahadvs, notmart, sitter
Priority: NOR Keywords: drkonqi
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Patrick Silva 2023-03-20 00:43:27 UTC
Application: spectacle (23.03.80)

Qt Version: 5.15.8
Frameworks Version: 5.104.0
Operating System: Linux 6.1.20-1-lts x86_64
Windowing System: Wayland
Distribution: "Arch Linux"
DrKonqi: 5.27.3 [KCrashBackend]

-- Information about the crash:
use Wayland session, open Spectacle, record your screen with Spectacle, close Spectacle while it records your screen.
Crash notification appears.

The crash can be reproduced every time.

-- Backtrace:
Application: Spectacle (spectacle), signal: Aborted
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#7  0x00007f7cc94a0953 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#8  0x00007f7cc9451ea8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#9  0x00007f7cc943b53d in __GI_abort () at abort.c:79
#10 0x00007f7cc9a9fede in qt_message_fatal (message=<synthetic pointer>..., context=<optimized out>) at global/qlogging.cpp:1914
#11 QMessageLogger::fatal(char const*, ...) const (this=<optimized out>, msg=<optimized out>) at global/qlogging.cpp:893
#12 0x00007f7cc9aa16da in QThread::~QThread() (this=0x562f7ad3ebc0, this=<optimized out>) at thread/qthread.cpp:456
#13 0x00007f7ccc299585 in PipeWireRecordProduceThread::~PipeWireRecordProduceThread() (this=0x562f7ad3ebc0, this=<optimized out>) at /usr/src/debug/kpipewire/build/src/KPipeWireRecord_autogen/EWIEGA46WW/../../../../kpipewire-5.27.3/src/pipewirerecord_p.h:99
#14 PipeWireRecordProduceThread::~PipeWireRecordProduceThread() (this=0x562f7ad3ebc0, this=<optimized out>) at /usr/src/debug/kpipewire/build/src/KPipeWireRecord_autogen/EWIEGA46WW/../../../../kpipewire-5.27.3/src/pipewirerecord_p.h:99
#15 0x00007f7ccc29b808 in std::default_delete<PipeWireRecordProduceThread>::operator()(PipeWireRecordProduceThread*) const (__ptr=<optimized out>, this=<optimized out>) at /usr/include/c++/12.2.1/bits/unique_ptr.h:89
#16 std::unique_ptr<PipeWireRecordProduceThread, std::default_delete<PipeWireRecordProduceThread> >::~unique_ptr() (this=0x562f7a29ed18, this=<optimized out>) at /usr/include/c++/12.2.1/bits/unique_ptr.h:396
#17 PipeWireRecordPrivate::~PipeWireRecordPrivate() (this=0x562f7a29ed00, this=<optimized out>) at /usr/src/debug/kpipewire/kpipewire-5.27.3/src/pipewirerecord_p.h:124
#18 QScopedPointerDeleter<PipeWireRecordPrivate>::cleanup(PipeWireRecordPrivate*) (pointer=0x562f7a29ed00) at /usr/include/qt/QtCore/qscopedpointer.h:60
#19 QScopedPointerDeleter<PipeWireRecordPrivate>::cleanup(PipeWireRecordPrivate*) (pointer=0x562f7a29ed00) at /usr/include/qt/QtCore/qscopedpointer.h:52
#20 QScopedPointer<PipeWireRecordPrivate, QScopedPointerDeleter<PipeWireRecordPrivate> >::~QScopedPointer() (this=0x562f7a1856a0, this=<optimized out>) at /usr/include/qt/QtCore/qscopedpointer.h:107
#21 PipeWireRecord::~PipeWireRecord() (this=0x562f7a185690, this=<optimized out>) at /usr/src/debug/kpipewire/kpipewire-5.27.3/src/pipewirerecord.cpp:98
#22 0x00007f7ccc29b87e in PipeWireRecord::~PipeWireRecord() (this=0x562f7a185690, this=<optimized out>) at /usr/src/debug/kpipewire/kpipewire-5.27.3/src/pipewirerecord.cpp:98
#23 0x0000562f78a80671 in std::default_delete<PipeWireRecord>::operator()(PipeWireRecord*) const (__ptr=<optimized out>, this=<optimized out>) at /usr/include/c++/12.2.1/bits/unique_ptr.h:95
#24 std::unique_ptr<PipeWireRecord, std::default_delete<PipeWireRecord> >::~unique_ptr() (this=0x562f79eed120, this=<optimized out>) at /usr/include/c++/12.2.1/bits/unique_ptr.h:396
#25 VideoPlatformWayland::~VideoPlatformWayland() (this=0x562f79eed0f0, this=<optimized out>) at /usr/src/debug/spectacle/build/src/spectacle_autogen/UWYFJWVAJO/../../../../spectacle-23.03.80/src/Platforms/VideoPlatformWayland.h:19
#26 VideoPlatformWayland::~VideoPlatformWayland() (this=0x562f79eed0f0, this=<optimized out>) at /usr/src/debug/spectacle/build/src/spectacle_autogen/UWYFJWVAJO/../../../../spectacle-23.03.80/src/Platforms/VideoPlatformWayland.h:19
#27 0x0000562f78a93c9e in std::default_delete<VideoPlatform>::operator()(VideoPlatform*) const (__ptr=<optimized out>, this=<optimized out>) at /usr/include/c++/12.2.1/bits/unique_ptr.h:89
#28 std::unique_ptr<VideoPlatform, std::default_delete<VideoPlatform> >::~unique_ptr() (this=0x7ffd93a95970, this=<optimized out>) at /usr/include/c++/12.2.1/bits/unique_ptr.h:396
#29 SpectacleCore::~SpectacleCore() (this=0x7ffd93a95940, this=<optimized out>) at /usr/src/debug/spectacle/spectacle-23.03.80/src/SpectacleCore.cpp:228
#30 0x0000562f78a7bb37 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/spectacle/spectacle-23.03.80/src/Main.cpp:107
[Inferior 1 (process 20275) detached]

Reported using DrKonqi
Comment 1 Patrick Silva 2023-03-20 02:25:01 UTC
*** Bug 467595 has been marked as a duplicate of this bug. ***
Comment 2 Bug Janitor Service 2023-04-04 23:01:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kpipewire/-/merge_requests/55
Comment 3 Aleix Pol 2023-04-05 17:13:48 UTC
Git commit ebfd3755b4fa6b5a51fcbefa04f870ab6b77ead7 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 05/04/2023 at 16:34.
Pushed by apol into branch 'Plasma/5.27'.

Record: Do not crash when closing while recording

We were deactivating but we also need to wait for the thread to end.
This is blocking now, but this should only happen when forcing
unexpected terminations (i.e. destroyed while recording).

M  +4    -0    src/pipewirerecord.cpp

https://invent.kde.org/plasma/kpipewire/commit/ebfd3755b4fa6b5a51fcbefa04f870ab6b77ead7