mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-30 15:31:34 +00:00
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>
This commit is contained in:
parent
688917cdbb
commit
ad2e6ff52c
@ -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]))
|
||||
|
Loading…
Reference in New Issue
Block a user