soylent r73 - trunk/src
- From: treitter svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r73 - trunk/src
- Date: Mon, 11 Feb 2008 01:41:59 +0000 (GMT)
Author: treitter
Date: Mon Feb 11 01:41:59 2008
New Revision: 73
URL: http://svn.gnome.org/viewvc/soylent?rev=73&view=rev
Log:
make sure to free up memory in error cases for the recently-changed signal setup functions; also avoid an unnecessary allocation for the email and phone ones
Modified:
trunk/src/soylent-browser.c
Modified: trunk/src/soylent-browser.c
==============================================================================
--- trunk/src/soylent-browser.c (original)
+++ trunk/src/soylent-browser.c Mon Feb 11 01:41:59 2008
@@ -1738,32 +1738,37 @@
cb_data = g_new0 (cb_entry_changed_e_contact, 1);
cb_data->browser = browser;
- cb_data->widget_name = g_strdup (widget_name);
+ cb_data->widget_name = widget_name;
cb_data->field = g_new0 (EContactField, 1);
*(cb_data->field) = E_CONTACT_EMAIL_1 + i;
if (cb_data)
{
/* FIXME - use a version which uses g_signal_connect_data so we can
- * eventually free each instance of cb_data */
+ * eventually free each instance of cb_data */
connect_retval = widget_signal_connect (wtree, widget_name,
signal_name, callback,
cb_data);
+ }
- if (!connect_retval)
- {
- g_critical ("failed to set up signal handler for widget %s::%s\n",
- widget_name, signal_name);
- retval = FALSE;
- }
+ if (connect_retval)
+ {
+ /* success */
}
else
{
- g_critical ("failed to set up callback data for widget %s::%s\n",
- widget_name, signal_name);
- }
+ g_critical ("failed to set up signal handler for widget "
+ "%s::%s\n", widget_name, signal_name);
- g_free (widget_name);
+ retval = FALSE;
+
+ if (cb_data)
+ {
+ g_free (cb_data->field);
+ g_free (cb_data);
+ }
+ g_free (widget_name);
+ }
}
return retval;
@@ -1809,32 +1814,37 @@
cb_data = g_new0 (cb_entry_changed_e_contact, 1);
cb_data->browser = browser;
- cb_data->widget_name = g_strdup (widget_name);
+ cb_data->widget_name = widget_name;
cb_data->field = g_new0 (EContactField, 1);
*(cb_data->field) = e_contact_fields[i];
if (cb_data)
{
/* FIXME - use a version which uses g_signal_connect_data so we can
- * eventually free each instance of cb_data */
+ * eventually free each instance of cb_data */
connect_retval = widget_signal_connect (wtree, widget_name,
signal_name, callback,
cb_data);
+ }
- if (!connect_retval)
- {
- g_critical ("failed to set up signal handler for widget %s::%s\n",
- widget_name, signal_name);
- retval = FALSE;
- }
+ if (connect_retval)
+ {
+ /* success */
}
else
{
- g_critical ("failed to set up callback data for widget %s::%s\n",
- widget_name, signal_name);
- }
+ g_critical ("failed to set up signal handler for widget "
+ "%s::%s\n", widget_name, signal_name);
- g_free (widget_name);
+ retval = FALSE;
+
+ if (cb_data)
+ {
+ g_free (cb_data->field);
+ g_free (cb_data);
+ }
+ g_free (widget_name);
+ }
}
return retval;
@@ -1892,18 +1902,25 @@
connect_retval = widget_signal_connect (wtree, widget_name,
signal_name, callback,
cb_data);
+ }
- if (!connect_retval)
- {
- g_critical ("failed to set up signal handler for widget "
- "%s::%s\n", widget_name, signal_name);
- retval = FALSE;
- }
+ if (connect_retval)
+ {
+ /* success */
}
else
{
- g_critical ("failed to set up callback data for widget %s::%s\n",
- widget_name, signal_name);
+ g_critical ("failed to set up signal handler for widget "
+ "%s::%s\n", widget_name, signal_name);
+
+ retval = FALSE;
+
+ if (cb_data)
+ {
+ g_free (cb_data->field);
+ g_free (cb_data);
+ }
+ g_free (widget_name);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]