xwayland: Don't fetch global when shutting down DND

It might not be there when shutting down, so get it from a more managed
place. Note that this isn't strictly needed right now, but eventually,
the MetaWaylandCompositor pointer will be cleared using a g_clear*()
helper, which clears the pointer before freeing the instance, which
wouldn't work here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1863>
This commit is contained in:
Jonas Ådahl 2021-04-20 18:41:07 +02:00 committed by Marge Bot
parent 72f03e9c74
commit 5bc8823701
3 changed files with 9 additions and 8 deletions

View File

@ -976,10 +976,9 @@ meta_xwayland_init_dnd (Display *xdisplay)
}
void
meta_xwayland_shutdown_dnd (Display *xdisplay)
meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager,
Display *xdisplay)
{
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandManager *manager = &compositor->xwayland_manager;
MetaXWaylandDnd *dnd = manager->dnd;
g_assert (dnd != NULL);

View File

@ -41,7 +41,8 @@ meta_xwayland_handle_xevent (XEvent *event);
/* wl_data_device/X11 selection interoperation */
void meta_xwayland_init_dnd (Display *xdisplay);
void meta_xwayland_shutdown_dnd (Display *xdisplay);
void meta_xwayland_shutdown_dnd (MetaXWaylandManager *manager,
Display *xdisplay);
gboolean meta_xwayland_dnd_handle_event (XEvent *xevent);
const MetaWaylandDragDestFuncs * meta_xwayland_selection_get_drag_dest_funcs (void);

View File

@ -1208,17 +1208,18 @@ monitors_changed_cb (MetaMonitorManager *monitor_manager)
}
static void
on_x11_display_closing (MetaDisplay *display)
on_x11_display_closing (MetaDisplay *display,
MetaXWaylandManager *manager)
{
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
meta_xwayland_shutdown_dnd (xdisplay);
meta_xwayland_shutdown_dnd (manager, xdisplay);
g_signal_handlers_disconnect_by_func (meta_monitor_manager_get (),
monitors_changed_cb,
NULL);
g_signal_handlers_disconnect_by_func (display,
on_x11_display_closing,
NULL);
manager);
}
static void
@ -1262,7 +1263,7 @@ meta_xwayland_complete_init (MetaDisplay *display,
#endif
g_signal_connect (display, "x11-display-closing",
G_CALLBACK (on_x11_display_closing), NULL);
G_CALLBACK (on_x11_display_closing), manager);
meta_xwayland_init_dnd (xdisplay);
add_local_user_to_xhost (xdisplay);
meta_xwayland_init_xrandr (manager, xdisplay);