aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-01-02 21:32:29 +0800
committerMilan Crha <mcrha@redhat.com>2012-01-02 21:32:29 +0800
commita822d5da967c9d98d50cad83b9e36b1404195a19 (patch)
tree1bed0ccb3f91af04f7e97a37bb9649acbe8b1889
parentd41d432ccbcac3e527c351198584ab516d99ff24 (diff)
downloadgsoc2013-evolution-a822d5da967c9d98d50cad83b9e36b1404195a19.tar
gsoc2013-evolution-a822d5da967c9d98d50cad83b9e36b1404195a19.tar.gz
gsoc2013-evolution-a822d5da967c9d98d50cad83b9e36b1404195a19.tar.bz2
gsoc2013-evolution-a822d5da967c9d98d50cad83b9e36b1404195a19.tar.lz
gsoc2013-evolution-a822d5da967c9d98d50cad83b9e36b1404195a19.tar.xz
gsoc2013-evolution-a822d5da967c9d98d50cad83b9e36b1404195a19.tar.zst
gsoc2013-evolution-a822d5da967c9d98d50cad83b9e36b1404195a19.zip
Bug #641154 - Crash in emae_check_authtype_done
-rw-r--r--mail/em-account-editor.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 7164dbe53f..674c846973 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -267,6 +267,22 @@ static void emae_account_folder_changed (EMFolderSelectionButton *folder, EMAcco
G_DEFINE_TYPE (EMAccountEditor, em_account_editor, G_TYPE_OBJECT)
static void
+emae_config_gone_cb (gpointer pemae, GObject *pconfig)
+{
+ EMAccountEditor *emae = pemae;
+ struct _EMConfig *config = (struct _EMConfig *) pconfig;
+
+ if (!emae)
+ return;
+
+ if (emae->config == config)
+ emae->config = NULL;
+
+ if (emae->priv && emae->priv->config == config)
+ emae->priv->config = NULL;
+}
+
+static void
emae_config_target_changed_cb (EMAccountEditor *emae)
{
e_config_target_changed (
@@ -875,6 +891,9 @@ emae_finalize (GObject *object)
EMAccountEditor *emae = EM_ACCOUNT_EDITOR (object);
EMAccountEditorPrivate *priv = emae->priv;
+ if (priv->config)
+ g_object_weak_unref ((GObject *) priv->config, emae_config_gone_cb, emae);
+
if (priv->sig_added_id) {
ESignatureList *signatures;
@@ -2472,7 +2491,9 @@ emae_check_authtype_done (CamelService *camel_service,
available_authtypes = camel_service_query_auth_types_finish (
camel_service, result, &error);
- editor = E_CONFIG (service->emae->config)->window;
+ editor = NULL;
+ if (service->emae && service->emae->config && E_IS_CONFIG (service->emae->config))
+ editor = E_CONFIG (service->emae->config)->window;
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_warn_if_fail (available_authtypes == NULL);
@@ -2480,10 +2501,11 @@ emae_check_authtype_done (CamelService *camel_service,
} else if (error != NULL) {
g_warn_if_fail (available_authtypes == NULL);
- e_alert_run_dialog_for_args (
- GTK_WINDOW (service->check_dialog),
- "mail:checking-service-error",
- error->message, NULL);
+ if (service->check_dialog)
+ e_alert_run_dialog_for_args (
+ GTK_WINDOW (service->check_dialog),
+ "mail:checking-service-error",
+ error->message, NULL);
g_error_free (error);
} else {
@@ -2493,7 +2515,10 @@ emae_check_authtype_done (CamelService *camel_service,
g_list_free (available_authtypes);
}
- gtk_widget_destroy (service->check_dialog);
+ if (service->check_dialog) {
+ g_object_weak_unref (G_OBJECT (service->check_dialog), (GWeakNotify) g_nullify_pointer, &service->check_dialog);
+ gtk_widget_destroy (service->check_dialog);
+ }
service->check_dialog = NULL;
if (editor != NULL)
@@ -2570,6 +2595,7 @@ emae_check_authtype (GtkWidget *w,
service->check_dialog = e_alert_dialog_new_for_args (
parent, "mail:checking-service", NULL);
+ g_object_weak_ref (G_OBJECT (service->check_dialog), (GWeakNotify) g_nullify_pointer, &service->check_dialog);
g_object_ref (service->emae);
@@ -5273,6 +5299,8 @@ em_account_editor_construct (EMAccountEditor *emae,
ec, "commit",
G_CALLBACK (emae_commit), emae);
+ g_object_weak_ref (G_OBJECT (ec), emae_config_gone_cb, emae);
+
emae->config = priv->config = ec;
l = NULL;
for (i = 0; items[i].path; i++)