[evolution-data-server] CamelIMAPXServer: Fix CamelSession reference leak.



commit d85d8930582f0b9789853fc41d6f901db13e1fa6
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jul 14 23:35:35 2011 -0400

    CamelIMAPXServer: Fix CamelSession reference leak.
    
    CamelIMAPXServer was not releasing its CamelSession reference.
    
    Not that it matters much at the moment since CamelIMAPXServer instances
    themselves are not getting finalized.  Need to hunt down what's leaking
    those now...

 camel/providers/imapx/camel-imapx-server.c |   71 +++++++++++++++-------------
 1 files changed, 38 insertions(+), 33 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 12d5ac9..04a441e 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -5066,39 +5066,6 @@ imapx_parser_thread (gpointer d)
 	return NULL;
 }
 
-static void
-imapx_server_finalize (GObject *object)
-{
-	CamelIMAPXServer *is = CAMEL_IMAPX_SERVER (object);
-
-	camel_url_free (is->url);
-
-	g_static_rec_mutex_free (&is->queue_lock);
-	g_static_rec_mutex_free (&is->ostream_lock);
-	g_mutex_free (is->fetch_mutex);
-	g_cond_free (is->fetch_cond);
-
-	camel_folder_change_info_free (is->changes);
-
-	/* Chain up to parent's finalize() method. */
-	G_OBJECT_CLASS (camel_imapx_server_parent_class)->finalize (object);
-}
-
-static void
-imapx_server_constructed (GObject *object)
-{
-	CamelIMAPXServer *server;
-	CamelIMAPXServerClass *class;
-
-	server = CAMEL_IMAPX_SERVER (object);
-	class = CAMEL_IMAPX_SERVER_GET_CLASS (server);
-
-	server->tagprefix = class->tagprefix;
-	class->tagprefix++;
-	if (class->tagprefix > 'Z')
-		class->tagprefix = 'A';
-}
-
 static gboolean
 join_helper (gpointer thread)
 {
@@ -5136,11 +5103,49 @@ imapx_server_dispose (GObject *object)
 
 	imapx_disconnect (server);
 
+	if (server->session != NULL) {
+		g_object_unref (server->session);
+		server->session = NULL;
+	}
+
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (camel_imapx_server_parent_class)->dispose (object);
 }
 
 static void
+imapx_server_finalize (GObject *object)
+{
+	CamelIMAPXServer *is = CAMEL_IMAPX_SERVER (object);
+
+	camel_url_free (is->url);
+
+	g_static_rec_mutex_free (&is->queue_lock);
+	g_static_rec_mutex_free (&is->ostream_lock);
+	g_mutex_free (is->fetch_mutex);
+	g_cond_free (is->fetch_cond);
+
+	camel_folder_change_info_free (is->changes);
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (camel_imapx_server_parent_class)->finalize (object);
+}
+
+static void
+imapx_server_constructed (GObject *object)
+{
+	CamelIMAPXServer *server;
+	CamelIMAPXServerClass *class;
+
+	server = CAMEL_IMAPX_SERVER (object);
+	class = CAMEL_IMAPX_SERVER_GET_CLASS (server);
+
+	server->tagprefix = class->tagprefix;
+	class->tagprefix++;
+	if (class->tagprefix > 'Z')
+		class->tagprefix = 'A';
+}
+
+static void
 camel_imapx_server_class_init (CamelIMAPXServerClass *class)
 {
 	GObjectClass *object_class;



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