[gtk+/gtk-2-24] Remove dangling weak-refs to TreeModel object
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] Remove dangling weak-refs to TreeModel object
- Date: Thu, 9 May 2013 15:55:22 +0000 (UTC)
commit 8b719abcbb05005c359027675a89eb1512886979
Author: RĂ©mi Cardona <remi gentoo org>
Date: Mon Feb 25 23:53:38 2013 +0100
Remove dangling weak-refs to TreeModel object
When a tree view is detroyed, its GailTreeView is destroyed as well but the
weak references are kept and thus point to a freed memory block. A
segfault may arise when the model is destroyed in turn and the weak-ref
mechanism tries to clear the pointers in freed memory.
This patch removes the weak references either when the GailTreeView is
being freed or when a new model is attached to the underlying GtkTreeView.
https://bugzilla.gnome.org/show_bug.cgi?id=694711
modules/other/gail/gailtreeview.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/modules/other/gail/gailtreeview.c b/modules/other/gail/gailtreeview.c
index 47d079c..df0fc69 100644
--- a/modules/other/gail/gailtreeview.c
+++ b/modules/other/gail/gailtreeview.c
@@ -555,7 +555,10 @@ gail_tree_view_real_notify_gtk (GObject *obj,
tree_model = gtk_tree_view_get_model (tree_view);
if (gailview->tree_model)
- disconnect_model_signals (gailview);
+ {
+ g_object_remove_weak_pointer (G_OBJECT (gailview->tree_model), (gpointer *)&gailview->tree_model);
+ disconnect_model_signals (gailview);
+ }
clear_cached_data (gailview);
gailview->tree_model = tree_model;
/*
@@ -632,7 +635,10 @@ gail_tree_view_finalize (GObject *object)
g_object_unref (view->summary);
if (view->tree_model)
- disconnect_model_signals (view);
+ {
+ g_object_remove_weak_pointer (G_OBJECT (view->tree_model), (gpointer *)&view->tree_model);
+ disconnect_model_signals (view);
+ }
if (view->col_data)
{
@@ -684,6 +690,7 @@ gail_tree_view_destroyed (GtkWidget *widget,
widget);
if (gailview->tree_model)
{
+ g_object_remove_weak_pointer (G_OBJECT (gailview->tree_model), (gpointer *)&gailview->tree_model);
disconnect_model_signals (gailview);
gailview->tree_model = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]