SF.net SVN: geany: [2574] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Mon May 12 13:46:26 UTC 2008
Revision: 2574
http://geany.svn.sourceforge.net/geany/?rev=2574&view=rev
Author: eht16
Date: 2008-05-12 06:46:19 -0700 (Mon, 12 May 2008)
Log Message:
-----------
Clear a document's symbol list first after it was detached from its container to prevent crashes when saving files with collapsed symbol list items.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/symbols.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-12 12:40:37 UTC (rev 2573)
+++ trunk/ChangeLog 2008-05-12 13:46:19 UTC (rev 2574)
@@ -9,6 +9,10 @@
* src/socket.c:
Iconify the main window on Windows before de-iconifying it when
opening files remotely to ensure the main window pops up.
+ * src/symbols.c:
+ Clear a document's symbol list first after it was detached from its
+ container to prevent crashes when saving files with collapsed
+ symbol list items.
2008-05-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c 2008-05-12 12:40:37 UTC (rev 2573)
+++ trunk/src/symbols.c 2008-05-12 13:46:19 UTC (rev 2574)
@@ -807,19 +807,19 @@
/* the following code surely can be improved, at the moment it collects some iters
* for removal and after that the actual removal is done. I didn't find a way to find and remove
* an empty row in one loop (next iter fails then) */
-static void hide_empty_rows(GtkTreeModel *model, GtkTreeStore *store)
+static void hide_empty_rows(GtkTreeStore *store)
{
GtkTreeIter iter, *iters[MAX_SYMBOL_TYPES] = { NULL };
guint i = 0;
- if (! gtk_tree_model_get_iter_first(model, &iter))
+ if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
return; /* stop when first iter is invalid, i.e. no elements */
do /* first collect the iters we need to delete empty rows */
{
- if (! gtk_tree_model_iter_has_child(model, &iter))
+ if (! gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store), &iter))
iters[i++] = gtk_tree_iter_copy(&iter);
- } while (gtk_tree_model_iter_next(model, &iter));
+ } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
/* now actually delete the collected iters */
for (i = 0; i < MAX_SYMBOL_TYPES; i++)
@@ -837,7 +837,6 @@
GList *tmp;
const GList *tags;
GtkTreeIter iter;
- GtkTreeModel *model;
static gint prev_sort_mode = SYMBOLS_SORT_BY_NAME;
filetype_id ft_id = FILETYPE_ID(doc_list[idx].file_type);
@@ -852,13 +851,12 @@
if (doc_list[idx].tm_file == NULL || tags == NULL)
return FALSE;
- gtk_tree_store_clear(doc_list[idx].tag_store);
- /* unref the store to speed up the filling(from TreeView Tutorial) */
- model = gtk_tree_view_get_model(GTK_TREE_VIEW(doc_list[idx].tag_tree));
/* Make sure the model stays with us after the tree view unrefs it */
- g_object_ref(model);
+ g_object_ref(GTK_TREE_MODEL(doc_list[idx].tag_store));
/* Detach model from view */
gtk_tree_view_set_model(GTK_TREE_VIEW(doc_list[idx].tag_tree), NULL);
+ /* Clear all contents */
+ gtk_tree_store_clear(doc_list[idx].tag_store);
init_tag_list(idx);
for (tmp = (GList*)tags; tmp; tmp = g_list_next(tmp))
@@ -953,11 +951,13 @@
g_object_unref(icon);
}
}
- hide_empty_rows(model, doc_list[idx].tag_store);
+ hide_empty_rows(doc_list[idx].tag_store);
/* Re-attach model to view */
- gtk_tree_view_set_model(GTK_TREE_VIEW(doc_list[idx].tag_tree), model);
- g_object_unref(model);
+ gtk_tree_view_set_model(GTK_TREE_VIEW(doc_list[idx].tag_tree),
+ GTK_TREE_MODEL(doc_list[idx].tag_store));
+ g_object_unref(GTK_TREE_MODEL(doc_list[idx].tag_store));
gtk_tree_view_expand_all(GTK_TREE_VIEW(doc_list[idx].tag_tree));
+
return TRUE;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list