[gnome-applets/wip/segeiger/window-picker-in-process: 4/11] windowpicker/task-title.c: Properly disconnect signal handlers in dispose function
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/segeiger/window-picker-in-process: 4/11] windowpicker/task-title.c: Properly disconnect signal handlers in dispose function
- Date: Mon, 8 Jun 2015 22:56:01 +0000 (UTC)
commit e01615fa28aa2bea3f675f6c01e153cc1e938f00
Author: Sebastian Geiger <sbastig gmx net>
Date: Sun Jun 7 14:45:01 2015 +0200
windowpicker/task-title.c: Properly disconnect signal handlers in dispose function
When the object is destroyed the signal handlers
need to be properly disconnected to avoid that they
are called after the object has already been destroyed.
This only affects signal handlers that are not related to the object itself,
such as for WnckScreen.
windowpicker/src/task-title.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/windowpicker/src/task-title.c b/windowpicker/src/task-title.c
index 242fc01..09b558a 100644
--- a/windowpicker/src/task-title.c
+++ b/windowpicker/src/task-title.c
@@ -185,6 +185,7 @@ static void hide_title(TaskTitle *title) {
gtk_widget_set_tooltip_text (GTK_WIDGET (title), NULL);
gtk_widget_hide (title->priv->grid);
}
+
static void
on_active_window_changed (WnckScreen *screen,
WnckWindow *old_window,
@@ -405,11 +406,21 @@ task_title_setup (TaskTitle *title)
}
static void
-task_title_finalize (GObject *object)
+task_title_dispose (GObject *object)
{
TaskTitle *title = TASK_TITLE (object);
+ g_signal_handlers_disconnect_by_func (title->priv->screen, on_active_window_changed, title);
disconnect_window (title);
+
+ G_OBJECT_CLASS (task_title_parent_class)->dispose (object);
+}
+
+static void
+task_title_finalize (GObject *object)
+{
+ TaskTitle *title = TASK_TITLE (object);
+
g_object_unref (title->priv->quit_icon);
G_OBJECT_CLASS (task_title_parent_class)->finalize (object);
@@ -443,6 +454,7 @@ task_title_class_init (TaskTitleClass *klass)
GObjectClass *obj_class = G_OBJECT_CLASS (klass);
obj_class->constructor = task_title_constructor;
+ obj_class->dispose = task_title_dispose;
obj_class->finalize = task_title_finalize;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]