From b297c00c8918c4fe426237db949870e28f9fbc97 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 8 Mar 2025 16:02:23 +0100 Subject: [PATCH] properly join the video thread --- flake.nix | 2 +- src/frame_streams/sdl/sdl_video_frame_stream2.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 02d3b16..a20c079 100644 --- a/flake.nix +++ b/flake.nix @@ -48,7 +48,7 @@ patchelf ]; - # for some reason, buildInputs performs some magic an converts them to build dependencies, not runtime dependencies + # for some reason, buildInputs performs some magic and converts them to build dependencies, not runtime dependencies # also, non static dependencies (?? how to ensure ??) dlopenBuildInputs = with pkgs; [ dbus diff --git a/src/frame_streams/sdl/sdl_video_frame_stream2.cpp b/src/frame_streams/sdl/sdl_video_frame_stream2.cpp index 68a9fff..44b7c62 100644 --- a/src/frame_streams/sdl/sdl_video_frame_stream2.cpp +++ b/src/frame_streams/sdl/sdl_video_frame_stream2.cpp @@ -23,6 +23,10 @@ SDLVideo2InputDevice::SDLVideo2InputDevice(const SDL_CameraID dev) : _dev(dev) { } SDLVideo2InputDevice::~SDLVideo2InputDevice(void) { + if (_thread.joinable()) { + assert(_ref == 0); + _thread.join(); + } } std::shared_ptr> SDLVideo2InputDevice::subscribe(void) {