[evolution-data-server] Break reference cycle between CamelSession and CamelService.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Break reference cycle between CamelSession and CamelService.
- Date: Fri, 15 Jul 2011 03:40:56 +0000 (UTC)
commit 2aac8bb0e74ec3b8fb923ca0723bd93811215d7f
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jul 14 23:20:05 2011 -0400
Break reference cycle between CamelSession and CamelService.
CamelService now holds only a weak pointer to CamelSession.
camel/camel-service.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/camel/camel-service.c b/camel/camel-service.c
index bb2cec7..8ef2f42 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -52,8 +52,9 @@
typedef struct _AsyncContext AsyncContext;
struct _CamelServicePrivate {
+ gpointer session; /* weak pointer */
+
CamelProvider *provider;
- CamelSession *session;
CamelURL *url;
gchar *user_data_dir;
@@ -193,7 +194,10 @@ service_set_session (CamelService *service,
g_return_if_fail (CAMEL_IS_SESSION (session));
g_return_if_fail (service->priv->session == NULL);
- service->priv->session = g_object_ref (session);
+ service->priv->session = session;
+
+ g_object_add_weak_pointer (
+ G_OBJECT (service), &service->priv->session);
}
static void
@@ -294,7 +298,8 @@ service_dispose (GObject *object)
priv = CAMEL_SERVICE_GET_PRIVATE (object);
if (priv->session != NULL) {
- g_object_unref (priv->session);
+ g_object_remove_weak_pointer (
+ G_OBJECT (priv->session), &priv->session);
priv->session = NULL;
}
@@ -732,7 +737,7 @@ camel_service_get_session (CamelService *service)
{
g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL);
- return service->priv->session;
+ return CAMEL_SESSION (service->priv->session);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]