Skip to content

Commit

Permalink
Log instead of throwing orphaned when toplevels are destroyed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarek Yasser committed Jun 28, 2024
1 parent 0741868 commit eeaf76b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/server/frontend_wayland/xdg_decoration_unstable_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "mir/shell/surface_specification.h"
#include "mir/wayland/protocol_error.h"
#include "mir/log.h"

#include "xdg-decoration-unstable-v1_wrapper.h"
#include "xdg_output_v1.h"
Expand Down Expand Up @@ -113,13 +114,14 @@ void mir::frontend::XdgDecorationManagerV1::get_toplevel_decoration(wl_resource*
{ toplevels_with_decorations->erase(toplevel); });

tl->add_destroy_listener(
[toplevels_with_decorations = this->toplevels_with_decorations, toplevel]()
[toplevels_with_decorations = this->toplevels_with_decorations, client = this->client, toplevel]()
{
if (toplevels_with_decorations->contains(toplevel))
if (!client->is_being_destroyed() && toplevels_with_decorations->erase(toplevel) > 0)
{
toplevels_with_decorations->erase(toplevel);
BOOST_THROW_EXCEPTION(mir::wayland::ProtocolError(
toplevel, Error::orphaned, "Toplevel destroyed before its attached decoration"));
mir::log_warning("Toplevel destroyed before attached decoration!");
// https://github.com/canonical/mir/issues/3452
/* BOOST_THROW_EXCEPTION(mir::wayland::ProtocolError( */
/* resource, Error::orphaned, "Toplevel destroyed before its attached decoration")); */
}
});
}
Expand Down

0 comments on commit eeaf76b

Please sign in to comment.