[gtk+/gtk-2.90] In set_filter(), handle the case where the new filter is the same as the old filter



commit b0d92c6b7993ad7994bdd2afc2c531b57efbb588
Author: Federico Mena Quintero <federico novell com>
Date:   Thu Sep 10 17:22:12 2009 -0500

    In set_filter(), handle the case where the new filter is the same as the old filter
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 gtk/gtkfilesystemmodel.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index e10babc..4c90fe2 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -1809,15 +1809,20 @@ void
 _gtk_file_system_model_set_filter (GtkFileSystemModel      *model,
 				   GtkFileFilter *          filter)
 {
+  GtkFileFilter *old_filter;
+
   g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model));
   g_return_if_fail (filter == NULL || GTK_IS_FILE_FILTER (filter));
   
   if (filter)
     g_object_ref (filter);
-  if (model->filter)
-    g_object_unref (model->filter);
+
+  old_filter = model->filter;
   model->filter = filter;
 
+  if (old_filter)
+    g_object_unref (old_filter);
+
   gtk_file_system_model_refilter_all (model);
 }
 



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