From 50fb34902f76cf6f5747dd372980a7b2a188bd75 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Wed, 4 Jul 2007 17:02:33 +0000 Subject: [PATCH] * copy the list of attachments; this fixes the first crash when closing a edit window with a message with an attachment pmo-trunk-r2575 --- src/maemo/modest-msg-edit-window.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index 67f6917..176dd2b 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -1071,7 +1071,16 @@ modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window) else data->html_body = NULL; - data->attachments = priv->attachments; /* TODO: copy and free ? */ + /* deep-copy the data */ + GList *cursor = priv->attachments; + data->attachments = NULL; + while (cursor) { + data->attachments = g_list_append (data->attachments, + g_strdup ((gchar*)cursor->data)); + cursor = g_list_next (cursor); + } + + data->priority_flags = priv->priority_flags; return data; @@ -1103,8 +1112,6 @@ modest_msg_edit_window_free_msg_data (ModestMsgEditWindow *edit_window, g_list_foreach (data->attachments, (GFunc)g_free, NULL); g_list_free (data->attachments); - /* TODO: Free data->attachments? */ - g_slice_free (MsgData, data); } -- 1.7.9.5