[evolution] Part of bug #574940 - Do not use freed memory in EMFolderView/Browser



commit 69a1e923a71ee881721e21b991de08b897f9e7b0
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 1 21:27:44 2009 +0200

    Part of bug #574940 - Do not use freed memory in EMFolderView/Browser
---
 mail/em-folder-browser.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 3c2d223..50add07 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -1939,8 +1939,12 @@ emfb_gui_folder_changed(CamelFolder *folder, gpointer dummy, EMFolderBrowser *em
 
 		mi = camel_folder_get_message_info(emfb->view.folder, emfb->priv->select_uid);
 		if (mi) {
+			/* because some sub-functions might free the pointer before it's done here */
+			gchar *uid = g_strdup (emfb->priv->select_uid);
+
 			camel_folder_free_message_info(emfb->view.folder, mi);
-			em_folder_view_set_message(&emfb->view, emfb->priv->select_uid, FALSE);
+			em_folder_view_set_message (&emfb->view, uid, FALSE);
+			g_free (uid);
 			g_free (emfb->priv->select_uid);
 			emfb->priv->select_uid = NULL;
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]