From 0af3d215738632c2448bd225a8888787df7c568c Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 14 Oct 2020 16:26:52 -0700 Subject: [PATCH] macos: only emit popup-layout-changed after initial present Otherwise we risk being re-entrant where GtkPopover will not have a GdkPopupLayout causing other issues. --- gdk/macos/gdkmacospopupsurface.c | 4 ++-- gdk/macos/gdkmacossurface.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gdk/macos/gdkmacospopupsurface.c b/gdk/macos/gdkmacospopupsurface.c index 5729fea338..48c2ca02b8 100644 --- a/gdk/macos/gdkmacospopupsurface.c +++ b/gdk/macos/gdkmacospopupsurface.c @@ -121,8 +121,6 @@ gdk_macos_popup_surface_present (GdkPopup *popup, gdk_macos_popup_surface_layout (self, width, height, layout); - GDK_MACOS_SURFACE (self)->did_initial_present = TRUE; - if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self))) return TRUE; @@ -144,6 +142,8 @@ gdk_macos_popup_surface_present (GdkPopup *popup, show_popup (GDK_MACOS_POPUP_SURFACE (self)); } + GDK_MACOS_SURFACE (self)->did_initial_present = TRUE; + return GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)); } diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c index 4b8fedcaf4..ec0fb41560 100644 --- a/gdk/macos/gdkmacossurface.c +++ b/gdk/macos/gdkmacossurface.c @@ -84,7 +84,7 @@ _gdk_macos_surface_reposition_children (GdkMacosSurface *self) _gdk_macos_popup_surface_reposition (GDK_MACOS_POPUP_SURFACE (child)); } - if (GDK_IS_POPUP (self)) + if (GDK_IS_POPUP (self) && self->did_initial_present) g_signal_emit_by_name (self, "popup-layout-changed"); }