Skip to content

Commit

Permalink
xwayland: fix destruction sequence when there are pending transactions (
Browse files Browse the repository at this point in the history
  • Loading branch information
ammen99 authored Oct 23, 2023
1 parent e520c99 commit 90d3bae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/view/xwayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,11 @@ void wf::xwayland_bring_to_front(wlr_surface *surface)
#if WF_HAS_XWAYLAND
if (wlr_surface_is_xwayland_surface(surface))
{
auto xw = wlr_xwayland_surface_from_wlr_surface(surface);
wlr_xwayland_surface_restack(xw, NULL, XCB_STACK_MODE_ABOVE);
// Conversion to wlr surface might fail if we are at the very end of the surface life cycle.
if (auto xw = wlr_xwayland_surface_from_wlr_surface(surface))
{
wlr_xwayland_surface_restack(xw, NULL, XCB_STACK_MODE_ABOVE);
}
}

#endif
Expand Down
4 changes: 3 additions & 1 deletion src/view/xwayland/xwayland-toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ wf::xw::xwayland_toplevel_t::xwayland_toplevel_t(wlr_xwayland_surface *xw)
this->xw = NULL;
on_xw_destroy.disconnect();
on_surface_commit.disconnect();
emit_ready();

// Emit the ready signal on the next idle, to give all substructures time to properly deinitialize.
idle_ready.run_once([&] () { emit_ready(); });
});

on_xw_destroy.connect(&xw->events.destroy);
Expand Down
2 changes: 2 additions & 0 deletions src/view/xwayland/xwayland-toplevel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "config.h"
#include "wayfire/geometry.hpp"
#include "wayfire/util.hpp"
#include <memory>
#include <wayfire/toplevel.hpp>
#include <wayfire/nonstd/wlroots-full.hpp>
Expand Down Expand Up @@ -44,6 +45,7 @@ class xwayland_toplevel_t : public wf::toplevel_t, public std::enable_shared_fro

wf::wl_listener_wrapper on_surface_commit;
wf::wl_listener_wrapper on_xw_destroy;
wf::wl_idle_call idle_ready;

wlr_xwayland_surface *xw;
wf::point_t output_offset = {0, 0};
Expand Down

0 comments on commit 90d3bae

Please sign in to comment.