x11-selection: Unref owners and cancellables on shutdown

Selection owners are set using g_set_object in source_new_cb, but that
reference is never removed on shutdown.

Similarly the cancellables created in handle_xfixes_selection_notify are
never freed on shutdown.

Fixes parts of https://gitlab.gnome.org/GNOME/mutter/issues/1006
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1001
This commit is contained in:
Sebastian Keller 2020-01-30 09:19:39 +01:00 committed by Robert Mader
parent d699c80ac2
commit b41094ef5f

View File

@ -442,10 +442,22 @@ void
meta_x11_selection_shutdown (MetaX11Display *x11_display)
{
MetaDisplay *display = meta_get_display ();
guint i;
g_signal_handlers_disconnect_by_func (meta_display_get_selection (display),
owner_changed_cb,
x11_display);
for (i = 0; i < META_N_SELECTION_TYPES; i++)
{
g_clear_object (&x11_display->selection.owners[i]);
if (x11_display->selection.cancellables[i])
{
g_cancellable_cancel (x11_display->selection.cancellables[i]);
g_clear_object (&x11_display->selection.cancellables[i]);
}
}
if (x11_display->selection.xwindow != None)
{
XDestroyWindow (x11_display->xdisplay, x11_display->selection.xwindow);