popover: Use g_signal_connect_object on parent widget signal

The popover may be destroyed, leaving this dangling signal. This
may cause crashes on future parent widget resizes.
This commit is contained in:
Carlos Garnacho 2020-01-05 20:17:38 +01:00 committed by Matthias Clasen
parent 508570864d
commit dbb3727b03

View File

@ -1482,7 +1482,8 @@ gtk_popover_set_relative_to (GtkPopover *popover,
if (priv->relative_to)
{
g_signal_connect (priv->relative_to, "size-allocate", G_CALLBACK (size_changed), popover);
g_signal_connect_object (priv->relative_to, "size-allocate",
G_CALLBACK (size_changed), popover, 0);
gtk_css_node_set_parent (gtk_widget_get_css_node (GTK_WIDGET (popover)),
gtk_widget_get_css_node (relative_to));
gtk_widget_set_parent (GTK_WIDGET (popover), relative_to);