Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xwayland: fix destruction sequence when there are pending transactions #1970

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading