aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-07-18 02:47:44 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-07-18 02:47:44 +0800
commit217e75d071c4de2305d44af930e7a6ebd7b453f0 (patch)
treed9fe5954c026019c9ad5037e801eb7a279b5837c
parentd54c49a59b9f56f48ab8e04856fe7134c6b1787a (diff)
downloadgsoc2013-evolution-217e75d071c4de2305d44af930e7a6ebd7b453f0.tar
gsoc2013-evolution-217e75d071c4de2305d44af930e7a6ebd7b453f0.tar.gz
gsoc2013-evolution-217e75d071c4de2305d44af930e7a6ebd7b453f0.tar.bz2
gsoc2013-evolution-217e75d071c4de2305d44af930e7a6ebd7b453f0.tar.lz
gsoc2013-evolution-217e75d071c4de2305d44af930e7a6ebd7b453f0.tar.xz
gsoc2013-evolution-217e75d071c4de2305d44af930e7a6ebd7b453f0.tar.zst
gsoc2013-evolution-217e75d071c4de2305d44af930e7a6ebd7b453f0.zip
Removed old, broken code and annoying g_messages.
2001-07-17 Jon Trowbridge <trow@ximian.com> * backend/ebook/e-destination.c (e_destination_set_string): Removed old, broken code and annoying g_messages. * backend/ebook/e-book-listener.c (e_book_listener_queue_response): Hold a reference to the listener while the idle function is active. (e_book_listener_check_queue): Only release our reference to the listener when the queue is empty. These two changes fix a race condition, since the listener could be unrefed while the listener was still active. (Seems to fix bug #4485) svn path=/trunk/; revision=11164
-rw-r--r--addressbook/ChangeLog13
-rw-r--r--addressbook/backend/ebook/e-book-listener.c10
-rw-r--r--addressbook/backend/ebook/e-destination.c49
3 files changed, 22 insertions, 50 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 985cf01727..564afc0e2e 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,16 @@
+2001-07-17 Jon Trowbridge <trow@ximian.com>
+
+ * backend/ebook/e-destination.c (e_destination_set_string): Removed
+ old, broken code and annoying g_messages.
+
+ * backend/ebook/e-book-listener.c
+ (e_book_listener_queue_response): Hold a reference to the listener
+ while the idle function is active.
+ (e_book_listener_check_queue): Only release our reference to the
+ listener when the queue is empty. These two changes fix a race
+ condition, since the listener could be unrefed while the listener
+ was still active. (Seems to fix bug #4485)
+
2001-07-17 Christopher James Lahey <clahey@ximian.com>
* gui/contact-editor/contact-editor.glade,
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index 7670a8b35d..dd682cbce4 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -33,7 +33,6 @@ struct _EBookListenerPrivate {
static gboolean
e_book_listener_check_queue (EBookListener *listener)
{
- gtk_object_ref (GTK_OBJECT (listener));
if (listener->priv->response_queue != NULL) {
gtk_signal_emit (GTK_OBJECT (listener),
e_book_listener_signals [RESPONSES_QUEUED]);
@@ -41,11 +40,14 @@ e_book_listener_check_queue (EBookListener *listener)
if (listener->priv->response_queue == NULL) {
listener->priv->idle_id = 0;
+
+ /* We only release our reference to the listener when the idle
+ function is totally finished. */
gtk_object_unref (GTK_OBJECT (listener));
+
return FALSE;
}
- gtk_object_unref (GTK_OBJECT (listener));
return TRUE;
}
@@ -58,6 +60,10 @@ e_book_listener_queue_response (EBookListener *listener,
response);
if (listener->priv->idle_id == 0) {
+
+ /* Hold a reference to the listener until the idle function is finished. */
+ gtk_object_ref (GTK_OBJECT (listener));
+
listener->priv->idle_id = g_idle_add (
(GSourceFunc) e_book_listener_check_queue, listener);
}
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index 8a25fd1937..42377aaa33 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -271,58 +271,11 @@ e_destination_set_email (EDestination *dest, const gchar *email)
void
e_destination_set_string (EDestination *dest, const gchar *str)
{
- gchar *name = NULL;
- gchar *email = NULL;
-#if 0
- gchar *lt, *gt;
-#endif
-
g_return_if_fail (dest && E_IS_DESTINATION (dest));
g_return_if_fail (str != NULL);
- /* This turned out to be an overly-clever approach... */
-#if 0
- /* Look for something of the form Jane Smith <jane@assbarn.com> */
- if ( (lt = strrchr (str, '<')) && (gt = strrchr (str, '>')) && lt+1 < gt) {
- name = g_strndup (str, lt-str);
- email = g_strndup (lt+1, gt-lt-1);
-
- /* I love using goto. It makes me feel so wicked. */
- goto finished;
- }
-
- /* If it contains '@', assume it is an e-mail address. */
- if (strchr (str, '@')) {
- email = g_strdup (str);
- goto finished;
- }
-
- /* If we contain whitespace, that is very suggestive of being a name. */
- if (strchr (str, ' ')) {
- name = g_strdup (str);
- goto finished;
- }
-#endif
-
/* Default: Just treat it as a name address. */
- name = g_strdup (str);
-
-#if 0
- finished:
-#endif
- if (name) {
- g_message ("name: [%s]", name);
- if (*name)
- e_destination_set_name (dest, name);
- g_free (name);
- }
-
- if (email) {
- g_message ("email: [%s]", email);
- if (*email)
- e_destination_set_email (dest, email);
- g_free (email);
- }
+ e_destination_set_name (dest, str);
}
void