mirror of
https://github.com/brl/mutter.git
synced 2025-06-29 00:13:04 +00:00
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
(cherry picked from commit e1fa0734a9
)
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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user