gdk/x11: Store idle ID, and ensure it is eventually unset

This idle happens on mutter around the x11 display being closed, which
has it running after it did actually happen. Ensure the window removes
this idle on dispose.
This commit is contained in:
Carlos Garnacho 2019-08-02 12:46:30 +02:00
parent 52b125c928
commit a2b9ceaf99
2 changed files with 16 additions and 12 deletions

View File

@ -322,6 +322,8 @@ struct _GdkWindow
GdkWindowState old_state;
GdkWindowState state;
guint synthesized_crossing_event_id;
guint8 alpha;
guint8 fullscreen_mode;
@ -337,7 +339,6 @@ struct _GdkWindow
guint focus_on_map : 1;
guint shaped : 1;
guint support_multidevice : 1;
guint synthesize_crossing_event_queued : 1;
guint effective_visibility : 2;
guint visibility : 2; /* The visibility wrt the toplevel (i.e. based on clip_region) */
guint native_visibility : 2; /* the native visibility of a impl windows */

View File

@ -570,6 +570,12 @@ gdk_window_finalize (GObject *object)
_gdk_window_destroy (window, TRUE);
}
if (window->synthesized_crossing_event_id)
{
g_source_remove (window->synthesized_crossing_event_id);
window->synthesized_crossing_event_id = 0;
}
if (window->impl)
{
g_object_unref (window->impl);
@ -8977,7 +8983,7 @@ do_synthesize_crossing_event (gpointer data)
changed_toplevel = data;
changed_toplevel->synthesize_crossing_event_queued = FALSE;
changed_toplevel->synthesized_crossing_event_id = 0;
if (GDK_WINDOW_DESTROYED (changed_toplevel))
return FALSE;
@ -9036,17 +9042,14 @@ _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window)
toplevel = get_event_toplevel (changed_window);
if (!toplevel->synthesize_crossing_event_queued)
if (toplevel->synthesized_crossing_event_id == 0)
{
guint id;
toplevel->synthesize_crossing_event_queued = TRUE;
id = gdk_threads_add_idle_full (GDK_PRIORITY_EVENTS - 1,
do_synthesize_crossing_event,
g_object_ref (toplevel),
g_object_unref);
g_source_set_name_by_id (id, "[gtk+] do_synthesize_crossing_event");
toplevel->synthesized_crossing_event_id =
gdk_threads_add_idle_full (GDK_PRIORITY_EVENTS - 1,
do_synthesize_crossing_event,
toplevel, NULL);
g_source_set_name_by_id (toplevel->synthesized_crossing_event_id,
"[gtk+] do_synthesize_crossing_event");
}
}