[evolution/webkit] Bug #641154 - Crash in emae_check_authtype_done



commit 4f03472d638fe6a825931bd0bc29abdcdcd3b788
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 21 09:49:06 2011 +0200

    Bug #641154 - Crash in emae_check_authtype_done

 mail/em-account-editor.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 7d9f5ae..639c82f 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -130,6 +130,7 @@ typedef struct _EMAccountEditorService {
 
 	GtkWidget *check_dialog;
 	gint check_id;
+	struct _EMAccountEditorService **check_data;
 
 	GList *authtypes;	/* if "Check supported" */
 	CamelProvider *provider;
@@ -1936,9 +1937,18 @@ emae_check_authtype_done (const gchar *uri,
                           GList *types,
                           gpointer data)
 {
-	EMAccountEditorService *service = data;
+	EMAccountEditorService **pservice = data;
+	EMAccountEditorService *service;
 	GtkWidget *editor;
 
+	g_return_if_fail (pservice != NULL);
+
+	service = *pservice;
+	if (!service) {
+		g_free (pservice);
+		return;
+	}
+
 	editor = E_CONFIG (service->emae->config)->window;
 
 	if (service->check_dialog) {
@@ -1954,7 +1964,10 @@ emae_check_authtype_done (const gchar *uri,
 		gtk_widget_set_sensitive (editor, TRUE);
 
 	service->check_id = -1;
+	service->check_data = NULL;
 	g_object_unref (service->emae);
+	*pservice = NULL;
+	g_free (pservice);
 }
 
 static void
@@ -1966,6 +1979,9 @@ emae_check_authtype_response (GtkWidget *d,
 
 	editor = E_CONFIG (service->emae->config)->window;
 
+	if (service->check_data)
+		(*service->check_data) = NULL;
+	service->check_data = NULL;
 	mail_msg_cancel (service->check_id);
 	gtk_widget_destroy (service->check_dialog);
 	service->check_dialog = NULL;
@@ -1979,6 +1995,7 @@ emae_check_authtype (GtkWidget *w,
                      EMAccountEditorService *service)
 {
 	EMAccountEditor *emae = service->emae;
+	EMAccountEditorService **pservice;
 	EMailSession *session;
 	EAccount *account;
 	GtkWidget *editor;
@@ -2000,9 +2017,12 @@ emae_check_authtype (GtkWidget *w,
 	if (editor != NULL)
 		gtk_widget_set_sensitive (editor, FALSE);
 
+	pservice = g_new0 (EMAccountEditorService *, 1);
+	*pservice = service;
+	service->check_data = pservice;
 	service->check_id = mail_check_service (
 		session, uri, service->type,
-		emae_check_authtype_done, service);
+		emae_check_authtype_done, pservice);
 }
 
 static void



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