mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 03:10:09 +00:00
x11: Make sure stream stays alive long enough
When unreffing the stream from a different thread, the close function will schedule its cleanup asynchornously in the main thread. We need to make sure the stream object stays alive for as long as that hasn't happened, so ref() it. Fixes #2003
This commit is contained in:
parent
6455a54f6c
commit
96b782c026
@ -503,6 +503,7 @@ gdk_x11_selection_output_stream_invoke_close (gpointer stream)
|
||||
g_signal_handlers_disconnect_by_func (priv->display,
|
||||
gdk_x11_selection_output_stream_xevent,
|
||||
stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -512,7 +513,7 @@ gdk_x11_selection_output_stream_close (GOutputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_main_context_invoke (NULL, gdk_x11_selection_output_stream_invoke_close, stream);
|
||||
g_main_context_invoke (NULL, gdk_x11_selection_output_stream_invoke_close, g_object_ref (stream));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user