diff --git a/src/x11/meta-x11-selection-input-stream.c b/src/x11/meta-x11-selection-input-stream.c index 44309ba98..e8d782047 100644 --- a/src/x11/meta-x11-selection-input-stream.c +++ b/src/x11/meta-x11-selection-input-stream.c @@ -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; diff --git a/src/x11/meta-x11-selection-output-stream.c b/src/x11/meta-x11-selection-output-stream.c index 723903835..86615364a 100644 --- a/src/x11/meta-x11-selection-output-stream.c +++ b/src/x11/meta-x11-selection-output-stream.c @@ -489,6 +489,20 @@ meta_x11_selection_output_stream_close_finish (GOutputStream *stream, return g_task_propagate_boolean (G_TASK (result), error); } +static void +meta_x11_selection_output_stream_dispose (GObject *object) +{ + MetaX11SelectionOutputStream *stream = + META_X11_SELECTION_OUTPUT_STREAM (object); + MetaX11SelectionOutputStreamPrivate *priv = + meta_x11_selection_output_stream_get_instance_private (stream); + + priv->x11_display->selection.output_streams = + g_list_remove (priv->x11_display->selection.output_streams, stream); + + G_OBJECT_CLASS (meta_x11_selection_output_stream_parent_class)->dispose (object); +} + static void meta_x11_selection_output_stream_finalize (GObject *object) { @@ -514,6 +528,7 @@ meta_x11_selection_output_stream_class_init (MetaX11SelectionOutputStreamClass * GObjectClass *object_class = G_OBJECT_CLASS (klass); GOutputStreamClass *output_stream_class = G_OUTPUT_STREAM_CLASS (klass); + object_class->dispose = meta_x11_selection_output_stream_dispose; object_class->finalize = meta_x11_selection_output_stream_finalize; output_stream_class->write_fn = meta_x11_selection_output_stream_write;