aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog9
-rw-r--r--widgets/misc/e-attachment-bar.c13
2 files changed, 18 insertions, 4 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index b81351641a..b7bd55109d 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,12 @@
+2006-11-03 Parthasarathi Susarla <ajaysusarla@gmail.com>
+
+ ** Fixes bug #357492
+ * e-attachment-bar.c: (e_attachment_bar_remove_selected):
+ put the attachment pointes into a temporary array. Free the
+ pointers and the array after going thru the entire list
+ This prevents a crash and also fixes the issue of only few
+ attachments getting deleted.
+
2006-10-11 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #360237 & bug #359236
diff --git a/widgets/misc/e-attachment-bar.c b/widgets/misc/e-attachment-bar.c
index b4b3ef9fe5..d39cdf6051 100644
--- a/widgets/misc/e-attachment-bar.c
+++ b/widgets/misc/e-attachment-bar.c
@@ -466,7 +466,8 @@ e_attachment_bar_remove_selected (EAttachmentBar *bar)
EAttachment *attachment;
int id, left, nrem = 0;
GList *items;
-
+ GPtrArray *temp_arr;
+
g_return_if_fail (E_IS_ATTACHMENT_BAR (bar));
priv = bar->priv;
@@ -474,16 +475,20 @@ e_attachment_bar_remove_selected (EAttachmentBar *bar)
if (!(items = gnome_icon_list_get_selection ((GnomeIconList *) bar)))
return;
+ temp_arr = g_ptr_array_new ();
while (items != NULL) {
if ((id = GPOINTER_TO_INT (items->data) - nrem) < priv->attachments->len) {
- /* Note: this removes the item from the array due to the weak_ref callback */
- attachment = priv->attachments->pdata[id];
- g_object_unref (attachment);
+ attachment = E_ATTACHMENT(g_ptr_array_index (priv->attachments, id));
+ g_ptr_array_add (temp_arr, (gpointer)attachment);
+ g_ptr_array_remove_index (priv->attachments, id);
nrem++;
}
items = items->next;
}
+
+ g_ptr_array_foreach (temp_arr, (GFunc)g_object_unref, NULL);
+ g_ptr_array_free (temp_arr, TRUE);
update (bar);