aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorParthasarathi Susarla <ajaysusarla@gmail.com>2006-11-15 03:59:05 +0800
committerParthasarathi Susarla <saps@src.gnome.org>2006-11-15 03:59:05 +0800
commitced42ae969dda031fd889ced60ee13bc90721138 (patch)
treed4e87e1b563c43c76c8c0d12957bca7296a1ee6e /widgets
parent88c6a9a3f8eed157c56f7c5314c7caf603099889 (diff)
downloadgsoc2013-evolution-ced42ae969dda031fd889ced60ee13bc90721138.tar
gsoc2013-evolution-ced42ae969dda031fd889ced60ee13bc90721138.tar.gz
gsoc2013-evolution-ced42ae969dda031fd889ced60ee13bc90721138.tar.bz2
gsoc2013-evolution-ced42ae969dda031fd889ced60ee13bc90721138.tar.lz
gsoc2013-evolution-ced42ae969dda031fd889ced60ee13bc90721138.tar.xz
gsoc2013-evolution-ced42ae969dda031fd889ced60ee13bc90721138.tar.zst
gsoc2013-evolution-ced42ae969dda031fd889ced60ee13bc90721138.zip
** Fixes bug #357492 put the attachment pointes into a temporary array.
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. svn path=/trunk/; revision=32981
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);