[gtk+] GtkContainer: fix disconnection from frame clock
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkContainer: fix disconnection from frame clock
- Date: Thu, 14 Feb 2013 22:27:14 +0000 (UTC)
commit ce835dee743477b0afeb2d8ea77172af63c1ac43
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Feb 14 17:11:28 2013 -0500
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.
gtk/gtkcontainer.c | 23 +++++++++++++----------
gtk/gtkcontainerprivate.h | 1 +
gtk/gtkwidget.c | 9 ++++++---
3 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index e73ef2a..ce16fe4 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -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)
{
diff --git a/gtk/gtkcontainerprivate.h b/gtk/gtkcontainerprivate.h
index cd4bc5b..dd989d2 100644
--- a/gtk/gtkcontainerprivate.h
+++ b/gtk/gtkcontainerprivate.h
@@ -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
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 79cf9e2..48f9960 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]