x11: Do not warn on cancelled X11 selection sources

This shouldn't happen frequently, but is just a sign that the source is
being replaced by something else. Just keep the warning for other possible
error situations.

Also, plug the potential GError leak.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/598
This commit is contained in:
Carlos Garnacho 2019-05-13 12:44:30 +02:00 committed by Georges Basile Stavracas Neto
parent 329c4bc5b3
commit 9e82f9af25

View File

@ -249,7 +249,7 @@ source_new_cb (GObject *object,
MetaSelection *selection = data->selection; MetaSelection *selection = data->selection;
MetaSelectionType selection_type = data->selection_type; MetaSelectionType selection_type = data->selection_type;
MetaX11Display *x11_display = data->x11_display; MetaX11Display *x11_display = data->x11_display;
GError *error = NULL; g_autoptr (GError) error = NULL;
source = meta_selection_source_x11_new_finish (res, &error); source = meta_selection_source_x11_new_finish (res, &error);
if (source) if (source)
@ -257,7 +257,7 @@ source_new_cb (GObject *object,
meta_selection_set_owner (selection, selection_type, source); meta_selection_set_owner (selection, selection_type, source);
g_set_object (&x11_display->selection.owners[selection_type], source); g_set_object (&x11_display->selection.owners[selection_type], source);
} }
else else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{ {
g_warning ("Could not create selection source for X11: %s", g_warning ("Could not create selection source for X11: %s",
error->message); error->message);