[evolution-data-server] EAuthenticationMediator: Fix some runtime warnings.



commit 58e5817c2d48211ddbe4b8afd3a8200e44e29c9f
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Aug 23 21:22:04 2012 -0400

    EAuthenticationMediator: Fix some runtime warnings.
    
    In authentication_mediator_authenticator_thread(), the GDBusInterface
    was getting finalized a bit too soon.

 libebackend/e-authentication-mediator.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/libebackend/e-authentication-mediator.c b/libebackend/e-authentication-mediator.c
index 025de30..dea9b2d 100644
--- a/libebackend/e-authentication-mediator.c
+++ b/libebackend/e-authentication-mediator.c
@@ -464,7 +464,10 @@ authentication_mediator_authenticator_thread (gpointer data)
 	mediator = g_weak_ref_get (&closure->mediator);
 	g_return_val_if_fail (mediator != NULL, NULL);
 
-	interface = G_DBUS_INTERFACE_SKELETON (mediator->priv->interface);
+	/* Keep our own reference to the GDBusInterfaceSkeleton so
+	 * we can clean up signals after the mediator is disposed. */
+	interface = g_object_ref (mediator->priv->interface);
+
 	connection = e_authentication_mediator_get_connection (mediator);
 	object_path = e_authentication_mediator_get_object_path (mediator);
 
@@ -518,7 +521,8 @@ authentication_mediator_authenticator_thread (gpointer data)
 	g_source_unref (idle_source);
 
 	/* Unreference this before starting the main loop since
-	 * the mediator's dispose() method tells us when to quit. */
+	 * the mediator's dispose() method tells us when to quit.
+	 * If we don't do this then dispose() will never run. */
 	g_object_unref (mediator);
 
 	/* Now we mostly idle here until authentication is complete. */
@@ -534,6 +538,8 @@ authentication_mediator_authenticator_thread (gpointer data)
 
 	g_main_context_pop_thread_default (closure->main_context);
 
+	g_object_unref (interface);
+
 	thread_closure_unref (closure);
 
 	return NULL;



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