aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-01-19 15:54:28 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-01-19 15:54:28 +0800
commit86f07a3cd97dfda5abc2aa5eaf0bac556e8cf2a2 (patch)
treee32fb2c45d70401ad789e9675590bd671ea0849d
parent3da36c62ad05875f71021f8933b6dc7cd3dd9826 (diff)
downloadgsoc2013-evolution-86f07a3cd97dfda5abc2aa5eaf0bac556e8cf2a2.tar
gsoc2013-evolution-86f07a3cd97dfda5abc2aa5eaf0bac556e8cf2a2.tar.gz
gsoc2013-evolution-86f07a3cd97dfda5abc2aa5eaf0bac556e8cf2a2.tar.bz2
gsoc2013-evolution-86f07a3cd97dfda5abc2aa5eaf0bac556e8cf2a2.tar.lz
gsoc2013-evolution-86f07a3cd97dfda5abc2aa5eaf0bac556e8cf2a2.tar.xz
gsoc2013-evolution-86f07a3cd97dfda5abc2aa5eaf0bac556e8cf2a2.tar.zst
gsoc2013-evolution-86f07a3cd97dfda5abc2aa5eaf0bac556e8cf2a2.zip
always free the delivery elements and correct embarrassingly stupid memory
2001-01-19 JP Rosevear <jpr@ximian.com> * conduit/address-conduit.c (ecard_from_remote_record): always free the delivery elements and correct embarrassingly stupid memory error that was causing the addressbook conduit problems. * backend/ebook/e-book-view-listener.c (e_book_view_listener_check_queue): ref/unref ourself when processing in case someone we signal unrefs us. * conduit/address-conduit.c (sequence_complete): disconnect signals when complete svn path=/trunk/; revision=7641
-rw-r--r--addressbook/ChangeLog13
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.c3
-rw-r--r--addressbook/conduit/address-conduit.c29
3 files changed, 29 insertions, 16 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 87fa6f0fd5..673d4ac975 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,16 @@
+2001-01-19 JP Rosevear <jpr@ximian.com>
+
+ * conduit/address-conduit.c (ecard_from_remote_record): always free
+ the delivery elements and correct embarrassingly stupid memory error
+ that was causing the addressbook conduit problems.
+
+ * backend/ebook/e-book-view-listener.c
+ (e_book_view_listener_check_queue): ref/unref ourself when processing
+ in case someone we signal unrefs us.
+
+ * conduit/address-conduit.c (sequence_complete): disconnect signals
+ when complete
+
2001-01-17 Federico Mena Quintero <federico@ximian.com>
* backend/pas/pas-book-factory.c (pas_book_factory_activate): Made
diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c
index 23133ecc22..4ad674ccd8 100644
--- a/addressbook/backend/ebook/e-book-view-listener.c
+++ b/addressbook/backend/ebook/e-book-view-listener.c
@@ -33,6 +33,7 @@ struct _EBookViewListenerPrivate {
static gboolean
e_book_view_listener_check_queue (EBookViewListener *listener)
{
+ bonobo_object_ref (BONOBO_OBJECT (listener));
if (listener->priv->response_queue != NULL) {
gtk_signal_emit (GTK_OBJECT (listener),
e_book_view_listener_signals [RESPONSES_QUEUED]);
@@ -40,8 +41,10 @@ e_book_view_listener_check_queue (EBookViewListener *listener)
if (listener->priv->response_queue == NULL) {
listener->priv->idle_id = 0;
+ bonobo_object_unref (BONOBO_OBJECT (listener));
return FALSE;
}
+ bonobo_object_unref (BONOBO_OBJECT (listener));
return TRUE;
}
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
index 43ba2569e0..ec0856bc5a 100644
--- a/addressbook/conduit/address-conduit.c
+++ b/addressbook/conduit/address-conduit.c
@@ -277,7 +277,7 @@ get_entry_text (struct Address address, int field)
if (address.entry[field])
return e_pilot_utf8_from_pchar (address.entry[field]);
- return strdup ("");
+ return g_strdup ("");
}
static void
@@ -461,13 +461,13 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
if (address.entry[entryTitle]) {
char *txt = get_entry_text (address, entryTitle);
e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_TITLE, txt);
- free (txt);
+ g_free (txt);
}
if (address.entry[entryCompany]) {
char *txt = get_entry_text (address, entryCompany);
e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_ORG, txt);
- free (txt);
+ g_free (txt);
}
/* Address */
@@ -482,28 +482,23 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
if (address.entry[entryCountry])
delivery.country = get_entry_text (address, entryCountry);
if (address.entry[entryZip])
- delivery.code = address.entry[entryZip];
+ delivery.code = get_entry_text (address, entryZip);
string = e_card_delivery_address_to_string (&delivery);
e_card_simple_set (simple, E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS, string);
g_free (string);
- if (address.entry[entryAddress])
- free (delivery.street);
- if (address.entry[entryCity])
- free (delivery.city);
- if (address.entry[entryState])
- free (delivery.region);
- if (address.entry[entryCountry])
- free (delivery.country);
- if (address.entry[entryZip])
- free (delivery.code);
+ free (delivery.street);
+ free (delivery.city);
+ free (delivery.region);
+ free (delivery.country);
+ free (delivery.code);
/* Phone numbers */
for (i = entryPhone1; i <= entryPhone5; i++) {
char *phonelabel = ctxt->ai.phoneLabels[address.phoneLabel[i - entryPhone1]];
char *phonenum = get_entry_text (address, i);
-
+
if (!strcmp (phonelabel, "E-mail"))
e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_EMAIL, phonenum);
else if (!strcmp (phonelabel, "Home"))
@@ -520,9 +515,10 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PAGER, phonenum);
else if (!strcmp (phonelabel, "Mobile"))
e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_MOBILE, phonenum);
+
g_print (" ['%s' : '%s']\n", phonelabel, phonenum);
- free (phonenum);
+ g_free (phonenum);
}
e_card_simple_sync_card (simple);
@@ -605,6 +601,7 @@ card_removed (EBookView *book_view, const char *id, EAddrConduitContext *ctxt)
static void
sequence_complete (EBookView *book_view, EAddrConduitContext *ctxt)
{
+ gtk_signal_disconnect_by_data (GTK_OBJECT (book_view), ctxt);
gtk_object_unref (GTK_OBJECT (book_view));
gtk_main_quit ();
}