summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/file-manager/fm-tree-model.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index 500b905a..ed4fc6e7 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -779,9 +779,13 @@ stop_monitoring_directory (FMTreeModel *model, TreeNode *node)
static void
destroy_children_without_reporting (FMTreeModel *model, TreeNode *parent)
{
- while (parent->first_child != NULL)
+ TreeNode *current_child = parent->first_child;
+ TreeNode *next_child;
+ while (current_child != NULL)
{
- destroy_node_without_reporting (model, parent->first_child);
+ next_child = current_child->next;
+ destroy_node_without_reporting (model, current_child);
+ current_child = next_child;
}
}