From 2fc3ba5e7aba5a7a6fe79823064a8e3132bd1d16 Mon Sep 17 00:00:00 2001 From: Maurits Rijk Date: Tue, 31 May 2005 18:05:10 +0000 Subject: [PATCH] plug memory leak. Fixes #305995. 2005-05-31 Maurits Rijk * plug-ins/imagemap/imap_selection.c: plug memory leak. Fixes #305995. --- ChangeLog | 4 ++ plug-ins/imagemap/imap_selection.c | 67 ++++++++++++++++-------------- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2989b0f468..abb0245fdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-05-31 Maurits Rijk + + * plug-ins/imagemap/imap_selection.c: plug memory leak. Fixes #305995. + 2005-05-31 Sven Neumann * plug-ins/common/screenshot.c (select_window_x11): use XGrabKey() diff --git a/plug-ins/imagemap/imap_selection.c b/plug-ins/imagemap/imap_selection.c index e76adce94b..702b2b15f9 100644 --- a/plug-ins/imagemap/imap_selection.c +++ b/plug-ins/imagemap/imap_selection.c @@ -65,39 +65,44 @@ changed_cb(GtkTreeSelection *selection, gpointer param) { Selection_t *data = (Selection_t*) param; - if (data->select_lock) { - data->select_lock = FALSE; - } else { - Command_t *command, *sub_command; - GtkTreeModel *model; - GList *list = gtk_tree_selection_get_selected_rows (selection, &model); - - command = subcommand_start (NULL); - sub_command = unselect_all_command_new (data->object_list, NULL); - command_add_subcommand (command, sub_command); - - for (; list; list = list->next) + if (data->select_lock) + { + data->select_lock = FALSE; + } else { - Object_t *obj; - GtkTreeIter iter; - GtkTreePath *path = (GtkTreePath*) list->data; + Command_t *command, *sub_command; + GtkTreeModel *model; + GList *list, *selected_rows; + + selected_rows = gtk_tree_selection_get_selected_rows (selection, + &model); - gtk_tree_model_get_iter (model, &iter, path); - gtk_tree_model_get (model, &iter, 0, &obj, -1); - - sub_command = select_command_new (obj); - command_add_subcommand (command, sub_command); - } - - command_set_name (command, sub_command->name); - subcommand_end (); - - command_execute (command); - - g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL); - g_list_free (list); - - set_buttons (data); + command = subcommand_start (NULL); + sub_command = unselect_all_command_new (data->object_list, NULL); + command_add_subcommand (command, sub_command); + + for (list = selected_rows; list; list = list->next) + { + Object_t *obj; + GtkTreeIter iter; + GtkTreePath *path = (GtkTreePath*) list->data; + + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (model, &iter, 0, &obj, -1); + + sub_command = select_command_new (obj); + command_add_subcommand (command, sub_command); + } + + command_set_name (command, sub_command->name); + subcommand_end (); + + command_execute (command); + + g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL); + g_list_free (selected_rows); + + set_buttons (data); } }