Revision: 3915 http://geany.svn.sourceforge.net/geany/?rev=3915&view=rev Author: eht16 Date: 2009-07-04 09:22:49 +0000 (Sat, 04 Jul 2009)
Log Message: ----------- Fix warnings and possible crashes in the toolbar editor when the list of displayed toolbar items is empty.
Modified Paths: -------------- trunk/ChangeLog trunk/src/toolbar.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-07-04 09:22:24 UTC (rev 3914) +++ trunk/ChangeLog 2009-07-04 09:22:49 UTC (rev 3915) @@ -18,6 +18,8 @@ control the new Scintilla indentation mode for wrapped lines. * src/toolbar.c: Properly close the toolbar editor on delete-events. + Fix warnings and possible crashes in the toolbar editor when the list + of displayed toolbar items is empty.
2009-06-30 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/toolbar.c =================================================================== --- trunk/src/toolbar.c 2009-07-04 09:22:24 UTC (rev 3914) +++ trunk/src/toolbar.c 2009-07-04 09:22:49 UTC (rev 3915) @@ -690,6 +690,9 @@ return;
gtk_tree_model_get(model, &iter, 0, &name, -1); + if (! NZV(name)) + return; + atom = gdk_atom_intern(tb_editor_dnd_targets[0].target, FALSE); gtk_selection_data_set(data, atom, 8, (guchar*) name, strlen(name));
@@ -722,18 +725,23 @@
if (tree != tbw->tree_available || ! is_sep) { - GtkTreeIter iter, iter_before; + GtkTreeIter iter, iter_before, *iter_before_ptr; GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(tree));
if (tbw->last_drag_path != NULL) { gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter_before, tbw->last_drag_path);
+ if (gtk_list_store_iter_is_valid(store, &iter_before)) + iter_before_ptr = &iter_before; + else + iter_before_ptr = NULL; + if (tbw->last_drag_pos == GTK_TREE_VIEW_DROP_BEFORE || tbw->last_drag_pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE) - gtk_list_store_insert_before(store, &iter, &iter_before); + gtk_list_store_insert_before(store, &iter, iter_before_ptr); else - gtk_list_store_insert_after(store, &iter, &iter_before); + gtk_list_store_insert_after(store, &iter, iter_before_ptr);
gtk_list_store_set(store, &iter, 0, text, -1); } @@ -879,7 +887,7 @@
if (utils_str_equal(action_name, TB_EDITOR_SEPARATOR)) g_string_append_printf(data, "\t\t<separator/>\n"); - else + else if (NZV(action_name)) g_string_append_printf(data, "\t\t<toolitem action='%s' />\n", action_name);
g_free(action_name);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.