[anjuta] file-manager: Keep a weak reference to the IAnjutaVcs object in FileModel.



commit 06df9c1d664b846ac4f068364670a895f3360b56
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Sun Nov 25 20:27:41 2012 +0100

    file-manager: Keep a weak reference to the IAnjutaVcs object in FileModel.
    
    So that we don't call functions on it if it goes away.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=689054

 plugins/file-manager/file-model.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/plugins/file-manager/file-model.c b/plugins/file-manager/file-model.c
index 317def0..a30c1bf 100644
--- a/plugins/file-manager/file-model.c
+++ b/plugins/file-manager/file-model.c
@@ -797,5 +797,10 @@ file_model_set_ivcs (FileModel* model, IAnjutaVcs *ivcs)
 {
 	FileModelPrivate *priv = FILE_MODEL_GET_PRIVATE (model);
 
+	if (priv->ivcs)
+		g_object_remove_weak_pointer (G_OBJECT (priv->ivcs), &priv->ivcs);
+
 	priv->ivcs = ivcs;
+	if (priv->ivcs)
+		g_object_add_weak_pointer (G_OBJECT (priv->ivcs), &priv->ivcs);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]