summaryrefslogtreecommitdiff
path: root/gtk/gtkfilesystemmodel.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@novell.com>2009-09-02 15:23:21 -0500
committerBenjamin Otte <otte@gnome.org>2009-10-15 22:06:16 +0200
commitad2e6ff52c254c950602b4327fc314e9eb94ff26 (patch)
tree171b1ab842e3bf1a71b2ddbc91e664cc70998aea /gtk/gtkfilesystemmodel.c
parent688917cdbbbc42678c9bcfd9249fa80119000498 (diff)
downloadgtk+-ad2e6ff52c254c950602b4327fc314e9eb94ff26.tar.gz
When updating a file, handle the case where the old file info is the same as the new one
This prevents us from inadvertently losing the last ref to the info. Signed-off-by: Federico Mena Quintero <federico@novell.com>
Diffstat (limited to 'gtk/gtkfilesystemmodel.c')
-rw-r--r--gtk/gtkfilesystemmodel.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index 1f830f0d00..0baad5e864 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -1640,6 +1640,7 @@ _gtk_file_system_model_update_file (GtkFileSystemModel *model,
{
FileModelNode *node;
guint i, id;
+ GFileInfo *old_info;
g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model));
g_return_if_fail (G_IS_FILE (file));
@@ -1650,9 +1651,12 @@ _gtk_file_system_model_update_file (GtkFileSystemModel *model,
add_file (model, file, info);
node = get_node (model, id);
- if (node->info)
- g_object_unref (node->info);
+
+ old_info = node->info;
node->info = g_object_ref (info);
+ if (old_info)
+ g_object_unref (old_info);
+
for (i = 0; i < model->n_columns; i++)
{
if (G_VALUE_TYPE (&node->values[i]))