forked from AuroraMiddleware/gtk
GtkContainer: fix disconnection from frame clock
We need to disconnect the frame clock when we unrealize (at which point the old clock is still alive) not in destroy(). Since there is no common unrealize for containers, trigger this from GtkWidget.
This commit is contained in:
parent
7bb07317f3
commit
ce835dee74
@ -1362,13 +1362,6 @@ gtk_container_destroy (GtkWidget *widget)
|
||||
if (priv->restyle_pending)
|
||||
priv->restyle_pending = FALSE;
|
||||
|
||||
if (priv->resize_handler)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->resize_clock, priv->resize_handler);
|
||||
priv->resize_handler = 0;
|
||||
priv->resize_clock = NULL;
|
||||
}
|
||||
|
||||
if (priv->focus_child)
|
||||
{
|
||||
g_object_unref (priv->focus_child);
|
||||
@ -1680,9 +1673,7 @@ gtk_container_idle_sizer (GdkFrameClock *clock,
|
||||
|
||||
if (!container->priv->restyle_pending && !container->priv->resize_pending)
|
||||
{
|
||||
g_signal_handler_disconnect (clock, container->priv->resize_handler);
|
||||
container->priv->resize_handler = 0;
|
||||
container->priv->resize_clock = NULL;
|
||||
_gtk_container_stop_idle_sizer (container);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1710,6 +1701,18 @@ gtk_container_start_idle_sizer (GtkContainer *container)
|
||||
GDK_FRAME_CLOCK_PHASE_LAYOUT);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_container_stop_idle_sizer (GtkContainer *container)
|
||||
{
|
||||
if (container->priv->resize_handler == 0)
|
||||
return;
|
||||
|
||||
g_signal_handler_disconnect (container->priv->resize_clock,
|
||||
container->priv->resize_handler);
|
||||
container->priv->resize_handler = 0;
|
||||
container->priv->resize_clock = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_queue_resize_handler (GtkContainer *container)
|
||||
{
|
||||
|
@ -39,6 +39,7 @@ GList * _gtk_container_focus_sort (GtkContainer *container,
|
||||
GtkWidget *old_focus);
|
||||
gboolean _gtk_container_get_reallocate_redraws (GtkContainer *container);
|
||||
|
||||
void _gtk_container_stop_idle_sizer (GtkContainer *container);
|
||||
void _gtk_container_maybe_start_idle_sizer (GtkContainer *container);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -4694,6 +4694,9 @@ gtk_widget_connect_frame_clock (GtkWidget *widget,
|
||||
{
|
||||
GtkWidgetPrivate *priv = widget->priv;
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
_gtk_container_maybe_start_idle_sizer (GTK_CONTAINER (widget));
|
||||
|
||||
if (priv->tick_callbacks != NULL)
|
||||
{
|
||||
g_signal_connect (frame_clock, "update",
|
||||
@ -4713,6 +4716,9 @@ gtk_widget_disconnect_frame_clock (GtkWidget *widget,
|
||||
{
|
||||
GtkWidgetPrivate *priv = widget->priv;
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
_gtk_container_stop_idle_sizer (GTK_CONTAINER (widget));
|
||||
|
||||
if (priv->tick_callbacks)
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
(gpointer) gtk_widget_on_frame_clock_update,
|
||||
@ -4802,9 +4808,6 @@ gtk_widget_realize (GtkWidget *widget)
|
||||
_gtk_widget_enable_device_events (widget);
|
||||
gtk_widget_update_devices_mask (widget, TRUE);
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
_gtk_container_maybe_start_idle_sizer (GTK_CONTAINER (widget));
|
||||
|
||||
gtk_widget_connect_frame_clock (widget,
|
||||
gtk_widget_get_frame_clock (widget));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user