[gnome-builder] project-tree: avoid infinite loop while iterating tree nodes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] project-tree: avoid infinite loop while iterating tree nodes
- Date: Sat, 2 Jul 2016 08:14:11 +0000 (UTC)
commit 7c39eace38eb55e88cb9b7b6e627110f3b82889c
Author: Christian Hergert <chergert redhat com>
Date: Sat Jul 2 01:13:30 2016 -0700
project-tree: avoid infinite loop while iterating tree nodes
This shouldn't be able to happen, but better protect against this anyway
in case we remove the "root project node".
plugins/project-tree/gb-project-tree-actions.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/plugins/project-tree/gb-project-tree-actions.c b/plugins/project-tree/gb-project-tree-actions.c
index 716ab6b..8cffa71 100644
--- a/plugins/project-tree/gb-project-tree-actions.c
+++ b/plugins/project-tree/gb-project-tree-actions.c
@@ -533,15 +533,19 @@ again:
*/
if (!is_dir)
{
- GtkTreePath *path;
-
selected = ide_tree_node_get_parent (selected);
- ide_tree_node_select (selected);
- path = ide_tree_node_get_path (selected);
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (self), path, NULL, FALSE, 0, 0);
- gtk_tree_path_free (path);
- goto again;
+ if (!ide_tree_node_is_root (selected))
+ {
+ GtkTreePath *path;
+
+ ide_tree_node_select (selected);
+ path = ide_tree_node_get_path (selected);
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (self), path, NULL, FALSE, 0, 0);
+ gtk_tree_path_free (path);
+
+ goto again;
+ }
}
if ((self->expanded_in_new = !ide_tree_node_get_expanded (selected)))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]