message_actions_execute() eventually calls summary_show()
to redisplay current folder in summaryview.
This causes a summary_clear(), which frees all MsgInfos
from the local linked list in mainwin_actions_execute().
This list is then used to restore summaryview selection, but
at this point, all its members point to already freed memory.
We solve this by increasing each MsgInfo's reference count,
so that they do not get freed, and we free them after we're
done with them.
Note: procmsg_msginfo_free() should probably be renamed to
procmsg_msginfo_unref()
mainwin_actions_execute(mainwin, action_nb, NULL);
}
+static void _free_msginfos(gpointer data, gpointer user_data)
+{
+ MsgInfo *msginfo = (MsgInfo *)data;
+
+ procmsg_msginfo_free(&msginfo);
+}
+
static void mainwin_actions_execute(MainWindow *mainwin, guint action_nb,
GtkWidget *widget)
{
msg_list = summary_get_selected_msg_list(mainwin->summaryview);
message_actions_execute(mainwin->messageview, action_nb, msg_list);
summary_select_by_msg_list(mainwin->summaryview, msg_list);
+ g_slist_foreach(msg_list, _free_msginfos, NULL);
g_slist_free(msg_list);
}
for (cur = GTK_CMCLIST(summaryview->ctree)->selection; cur != NULL && cur->data != NULL;
cur = cur->next) {
msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(cur->data);
- mlist = g_slist_prepend(mlist, msginfo);
+ mlist = g_slist_prepend(mlist,
+ procmsg_msginfo_new_ref(msginfo));
}
mlist = g_slist_reverse(mlist);