macos: add re-entrancy check when monitors change

This commit is contained in:
Christian Hergert 2022-03-02 00:32:50 -08:00 committed by Christian Hergert
parent 7369ce58da
commit 2e1e7e7265
2 changed files with 8 additions and 0 deletions

View File

@ -75,6 +75,7 @@ struct _GdkMacosSurface
guint geometry_dirty : 1;
guint next_frame_set : 1;
guint show_on_next_swap : 1;
guint in_change_monitor : 1;
guint in_frame : 1;
guint awaiting_frame : 1;
};

View File

@ -1035,6 +1035,11 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
if (self->in_change_monitor)
return;
self->in_change_monitor = TRUE;
_gdk_macos_surface_cancel_frame (self);
rect.x = self->root_x;
@ -1103,6 +1108,8 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
_gdk_macos_surface_configure (self);
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
self->in_change_monitor = FALSE;
_gdk_macos_surface_request_frame (self);
}