Skip to content

Commit

Permalink
Don't hold lock on mutex when calling functions that acquire a lock o…
Browse files Browse the repository at this point in the history
…n the mutex
  • Loading branch information
AlanGriffiths committed Aug 31, 2023
1 parent a67f858 commit 881a81a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/platforms/wayland/displayclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,13 @@ void mgw::DisplayClient::remove_global(
{
DisplayClient* self = static_cast<decltype(self)>(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.
Expand Down

0 comments on commit 881a81a

Please sign in to comment.