From 881a81afb910058704fbcf836232a75741cc45f8 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Thu, 31 Aug 2023 15:54:14 +0100 Subject: [PATCH] Don't hold lock on mutex when calling functions that acquire a lock on the mutex --- src/platforms/wayland/displayclient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platforms/wayland/displayclient.cpp b/src/platforms/wayland/displayclient.cpp index 27bdfe5e091..81da19081e4 100644 --- a/src/platforms/wayland/displayclient.cpp +++ b/src/platforms/wayland/displayclient.cpp @@ -641,12 +641,13 @@ void mgw::DisplayClient::remove_global( { DisplayClient* self = static_cast(data); - std::lock_guard lock{self->outputs_mutex}; + std::unique_lock lock{self->outputs_mutex}; auto const output = self->bound_outputs.find(id); if (output != self->bound_outputs.end()) { self->outputs_to_be_deleted.push_back(std::move(output->second)); self->bound_outputs.erase(output); + lock.unlock(); self->on_display_config_changed(); } // TODO: We should probably also delete any other globals we've bound to that disappear.