Re: [evolution-patches] unref the gconf client,avoid mem leak!



Hi JP:
Did not his patch commit in the trunk ? Could you comit it into the trunk?

Thanks
jack

JP Rosevear wrote:

On Thu, 2003-06-19 at 00:00, jack wrote:
JP & rodrigo!

sorry! I miss some places that should unref gconf client in the previous email. Please look the new patch.

I made a couple of changes to reduce the number of client
instantiations.  Attached.

-JP
------------------------------------------------------------------------

? gui/model.patch
? gui/ref.backup
? gui/ref.txt
? gui/dialogs/alarm-options.gladep
? gui/dialogs/event-page.gladep
? gui/dialogs/meeting-page.gladep
? gui/dialogs/task-page.gladep
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1794
diff -u -r1.1794 ChangeLog
--- ChangeLog	19 Jun 2003 14:24:24 -0000	1.1794
+++ ChangeLog	19 Jun 2003 14:40:31 -0000
@@ -1,3 +1,16 @@
+2003-06-19  JP Rosevear  <jpr ximian com>
+
+	* gui/itip-utils.c (itip_addresses_get): unref the gconf client
+	after use
+
+	* pcs/cal-backend-util.c (cal_backend_mail_account_get_default): same
+	(cal_backend_mail_account_is_valid): ditto
+	
+	* gui/alarm-notify/save.c (save_calendars_to_load): ditto
+	(get_calendars_to_load): ditto
+	(save_blessed_program): ditto
+	(is_blessed_program): ditto
+
2003-06-12  Jack Jia <jack jia sun com>
* gui/e-itip-control.c
Index: gui/itip-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/itip-utils.c,v
retrieving revision 1.78
diff -u -r1.78 itip-utils.c
--- gui/itip-utils.c	30 May 2003 17:35:10 -0000	1.78
+++ gui/itip-utils.c	19 Jun 2003 14:40:31 -0000
@@ -70,9 +70,14 @@
EAccountList *
itip_addresses_get (void)
{
-	if (accounts == NULL)
-		accounts = e_account_list_new(gconf_client_get_default());
-
+	if (accounts == NULL) {
+		GConfClient *client;
+		
+		client = gconf_client_get_default ();
+		accounts = e_account_list_new (client);
+		g_object_unref (client);
+	}
+	
	return accounts;
}

Index: gui/alarm-notify/save.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/save.c,v
retrieving revision 1.13
diff -u -r1.13 save.c
--- gui/alarm-notify/save.c	7 Mar 2003 12:53:19 -0000	1.13
+++ gui/alarm-notify/save.c	19 Jun 2003 14:40:31 -0000
@@ -111,6 +111,8 @@
	gconf_client_set_list(gconf, KEY_CALENDARS, GCONF_VALUE_STRING, l, NULL);

	g_slist_free(l);
+
+	g_object_unref (gconf);
}

/**
@@ -124,6 +126,7 @@
GPtrArray *
get_calendars_to_load (void)
{
+	GConfClient *gconf = gconf_client_get_default();
	GSList *l, *n;
	GPtrArray *uris;

@@ -131,7 +134,7 @@
	 * may not have saved the list of calendar yet.
	 */

-	l = gconf_client_get_list (gconf_client_get_default (), KEY_CALENDARS, GCONF_VALUE_STRING, NULL);
+	l = gconf_client_get_list (gconf, KEY_CALENDARS, GCONF_VALUE_STRING, NULL);
	uris = g_ptr_array_new ();
	while (l) {
		n = l->next;
@@ -140,6 +143,8 @@
		l = n;
	}

+	g_object_unref (gconf);
+	
	return uris;
}

@@ -160,6 +165,7 @@
	gconf_client_set_list(gconf, KEY_PROGRAMS, GCONF_VALUE_STRING, l, NULL);
	g_slist_foreach(l, (GFunc)g_free, NULL);
	g_slist_free(l);
+	g_object_unref (gconf);
}

/**
@@ -187,5 +193,7 @@
		l = n;
	}

+	g_object_unref (gconf);
+	
	return found;
}
Index: pcs/cal-backend-util.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/pcs/cal-backend-util.c,v
retrieving revision 1.6
diff -u -r1.6 cal-backend-util.c
--- pcs/cal-backend-util.c	24 Feb 2003 02:59:24 -0000	1.6
+++ pcs/cal-backend-util.c	19 Jun 2003 14:40:32 -0000
@@ -63,8 +63,13 @@
{
	const EAccount *account;

-	if (accounts == NULL)
-		accounts = e_account_list_new(gconf_client_get_default());
+	if (accounts == NULL) {
+		GConfClient *client;
+		
+		client = gconf_client_get_default ();
+		accounts = e_account_list_new (client);
+		g_object_unref (client);
+	}

	account = e_account_list_get_default(accounts);
	if (account) {
@@ -80,8 +85,13 @@
{
	const EAccount *account;

-	if (accounts == NULL)
-		accounts = e_account_list_new(gconf_client_get_default());
+	if (accounts == NULL) {
+		GConfClient *client;
+		
+		client = gconf_client_get_default ();
+		accounts = e_account_list_new (client);
+		g_object_unref (client);
+	}

	account = e_account_list_find(accounts, E_ACCOUNT_FIND_ID_ADDRESS, user);
	if (account)






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