x11: Detach selection streams on dispose
The streams were only detached from MetaX11Display (and its event handling) on completion. This is too much to expect, and those might be in some circumstances replaced while operating. Make those streams detach themselves on dispose(), so we don't trip into freed memory later on when trying to dispatch unrelated X11 selection events. https://gitlab.gnome.org/GNOME/mutter/merge_requests/869
This commit is contained in:
@ -261,6 +261,20 @@ meta_x11_selection_input_stream_close_finish (GInputStream *stream,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_x11_selection_input_stream_dispose (GObject *object)
|
||||
{
|
||||
MetaX11SelectionInputStream *stream =
|
||||
META_X11_SELECTION_INPUT_STREAM (object);
|
||||
MetaX11SelectionInputStreamPrivate *priv =
|
||||
meta_x11_selection_input_stream_get_instance_private (stream);
|
||||
|
||||
priv->x11_display->selection.input_streams =
|
||||
g_list_remove (priv->x11_display->selection.input_streams, stream);
|
||||
|
||||
G_OBJECT_CLASS (meta_x11_selection_input_stream_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_x11_selection_input_stream_finalize (GObject *object)
|
||||
{
|
||||
@ -284,6 +298,7 @@ meta_x11_selection_input_stream_class_init (MetaX11SelectionInputStreamClass *kl
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GInputStreamClass *istream_class = G_INPUT_STREAM_CLASS (klass);
|
||||
|
||||
object_class->dispose = meta_x11_selection_input_stream_dispose;
|
||||
object_class->finalize = meta_x11_selection_input_stream_finalize;
|
||||
|
||||
istream_class->read_fn = meta_x11_selection_input_stream_read;
|
||||
|
Reference in New Issue
Block a user