Popover: If can't get widget rect, zero output ptr

cherry-pick of commit a6d40b610b

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/893#note_1766079
This commit is contained in:
Daniel Boles 2023-06-11 11:46:36 +01:00
parent a02fc2d290
commit d0ebd42e3e

View File

@ -133,6 +133,8 @@
#include "gdk/gdksurfaceprivate.h" #include "gdk/gdksurfaceprivate.h"
#include <string.h> /* memset */
#define MNEMONICS_DELAY 300 /* ms */ #define MNEMONICS_DELAY 300 /* ms */
#define TAIL_GAP_WIDTH 24 #define TAIL_GAP_WIDTH 24
@ -2192,7 +2194,10 @@ gtk_popover_get_pointing_to (GtkPopover *popover,
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (popover)); GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (popover));
if (!gtk_widget_compute_bounds (parent, parent, &r)) if (!gtk_widget_compute_bounds (parent, parent, &r))
return FALSE; {
memset (rect, 0, sizeof (GdkRectangle));
return FALSE;
}
rect->x = floorf (r.origin.x); rect->x = floorf (r.origin.x);
rect->y = floorf (r.origin.y); rect->y = floorf (r.origin.y);