Skip to content

Commit

Permalink
pipewire: If hotplug initialization fails, clean up any partial success
Browse files Browse the repository at this point in the history
hotplug_loop_init() calls pw_context_new(), which creates a thread
internally (for the "data loop"). It also creates a thread of its own,
the `hotplug_loop`.

Both of these threads are running code from libpipewire, so before we
can allow the Pipewire library to be unloaded, we need to destroy
the context with pw_context_destroy() and destroy the `hotplug_loop`
with pw_thread_loop_destroy().

Resolves: libsdl-org#10787
Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed Sep 10, 2024
1 parent 817f1b3 commit ae0f967
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/audio/pipewire/SDL_pipewire.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,7 @@ static bool PipewireInitialize(SDL_AudioDriverImpl *impl)
}

if (!hotplug_loop_init()) {
hotplug_loop_destroy();
PIPEWIRE_Deinitialize();
return false;
}
Expand Down

0 comments on commit ae0f967

Please sign in to comment.