diff options
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 10 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book-view-listener.c | 29 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-book.c | 132 |
3 files changed, 88 insertions, 83 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 8dac6267cb..f47fe71a51 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,13 @@ +2001-08-01 Christopher James Lahey <clahey@ximian.com> + + * backend/ebook/e-book-view-listener.c + (e_book_view_listener_check_queue): Removed thrash checking code + here since thrashing shouldn't happen now that we've cleaned this + up some. + + * backend/ebook/e-book.c (e_book_do_response_get_view): Properly + handle cases where construction fails. + 2001-07-30 Christopher James Lahey <clahey@ximian.com> * backend/ebook/evolution-vcard-importer.c: Added #include diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c index 705cc155c8..7e0f6d5c29 100644 --- a/addressbook/backend/ebook/e-book-view-listener.c +++ b/addressbook/backend/ebook/e-book-view-listener.c @@ -32,48 +32,27 @@ struct _EBookViewListenerPrivate { guint stopped : 1; }; +/* Only release our listener reference when the idle is finished. */ static gboolean e_book_view_listener_check_queue (EBookViewListener *listener) { - static gint thrash = 0; - gint queue_len; - if (listener->priv->stopped) { listener->priv->idle_id = 0; - return TRUE; + bonobo_object_unref (BONOBO_OBJECT (listener)); + return FALSE; } - queue_len = g_list_length (listener->priv->response_queue); - - 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]); } - /* This means we didn't make any progress in dealing with what is on our - response queue. */ - if (queue_len == g_list_length (listener->priv->response_queue)) - ++thrash; - else - thrash = 0; - - if (thrash > 20 || listener->priv->response_queue == NULL) { - - if (thrash > 20) { - g_error ("e_book_view_listener_check_queue thrashing!"); - thrash = 0; - } - + if (listener->priv->response_queue == NULL) { listener->priv->idle_id = 0; - - /* Only release our listener reference when the idle is finished. */ bonobo_object_unref (BONOBO_OBJECT (listener)); - return FALSE; } - return TRUE; } diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c index 73b39b6c46..9c8111b714 100644 --- a/addressbook/backend/ebook/e-book.c +++ b/addressbook/backend/ebook/e-book.c @@ -206,28 +206,32 @@ e_book_do_response_get_cursor (EBook *book, cursor = e_card_cursor_new(resp->cursor); - if (op->cb) { - if (op->active) - ((EBookCursorCallback) op->cb) (book, resp->status, cursor, op->closure); - else - ((EBookCursorCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); - } + if (cursor != NULL) { + if (op->cb) { + if (op->active) + ((EBookCursorCallback) op->cb) (book, resp->status, cursor, op->closure); + else + ((EBookCursorCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); + } - /* - * Release the remote GNOME_Evolution_Addressbook_Book in the PAS. - */ - CORBA_exception_init (&ev); + /* + * Release the remote GNOME_Evolution_Addressbook_Book in the PAS. + */ + CORBA_exception_init (&ev); - bonobo_object_release_unref (resp->cursor, &ev); + bonobo_object_release_unref (resp->cursor, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_do_response_get_cursor: Exception releasing " - "remote GNOME_Evolution_Addressbook_CardCursor interface!\n"); - } + if (ev._major != CORBA_NO_EXCEPTION) { + g_warning ("e_book_do_response_get_cursor: Exception releasing " + "remote GNOME_Evolution_Addressbook_CardCursor interface!\n"); + } - CORBA_exception_free (&ev); + CORBA_exception_free (&ev); - gtk_object_unref(GTK_OBJECT(cursor)); + gtk_object_unref(GTK_OBJECT(cursor)); + } else { + ((EBookCursorCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); + } g_free (op); } @@ -251,35 +255,41 @@ e_book_do_response_get_view (EBook *book, } book_view = e_book_view_new(resp->book_view, op->listener); - e_book_view_set_book (book_view, book); - /* Only execute the callback if the operation is still flagged as active (i.e. hasn't - been cancelled. This is mildly wasteful since we unnecessaryily create the - book_view, etc... but I'm leery of tinkering with the CORBA magic. */ - if (op->cb) { - if (op->active) - ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure); - else - ((EBookBookViewCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); - } + if (book_view != NULL) { + e_book_view_set_book (book_view, book); + + /* Only execute the callback if the operation is still flagged as active (i.e. hasn't + been cancelled. This is mildly wasteful since we unnecessaryily create the + book_view, etc... but I'm leery of tinkering with the CORBA magic. */ + if (op->cb) { + if (op->active) + ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure); + else + ((EBookBookViewCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); + } - /* - * Release the remote GNOME_Evolution_Addressbook_Book in the PAS. - */ - CORBA_exception_init (&ev); + /* + * Release the remote GNOME_Evolution_Addressbook_Book in the PAS. + */ + CORBA_exception_init (&ev); - bonobo_object_release_unref (resp->book_view, &ev); + bonobo_object_release_unref (resp->book_view, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_do_response_get_view: Exception releasing " - "remote GNOME_Evolution_Addressbook_BookView interface!\n"); - } + if (ev._major != CORBA_NO_EXCEPTION) { + g_warning ("e_book_do_response_get_view: Exception releasing " + "remote GNOME_Evolution_Addressbook_BookView interface!\n"); + } - CORBA_exception_free (&ev); + CORBA_exception_free (&ev); + + gtk_object_unref(GTK_OBJECT(book_view)); + } else { + e_book_view_listener_stop (op->listener); + ((EBookBookViewCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); + } - gtk_object_unref(GTK_OBJECT(book_view)); bonobo_object_unref(BONOBO_OBJECT(op->listener)); - g_free (op); } @@ -300,32 +310,38 @@ e_book_do_response_get_changes (EBook *book, } book_view = e_book_view_new (resp->book_view, op->listener); - e_book_view_set_book (book_view, book); + + if (book_view != NULL) { + e_book_view_set_book (book_view, book); - if (op->cb) { - if (op->active) - ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure); - else - ((EBookBookViewCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); - } + if (op->cb) { + if (op->active) + ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure); + else + ((EBookBookViewCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); + } - /* - * Release the remote GNOME_Evolution_Addressbook_BookView in the PAS. - */ - CORBA_exception_init (&ev); + /* + * Release the remote GNOME_Evolution_Addressbook_BookView in the PAS. + */ + CORBA_exception_init (&ev); - bonobo_object_release_unref (resp->book_view, &ev); + bonobo_object_release_unref (resp->book_view, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_do_response_get_changes: Exception releasing " - "remote GNOME_Evolution_Addressbook_BookView interface!\n"); - } + if (ev._major != CORBA_NO_EXCEPTION) { + g_warning ("e_book_do_response_get_changes: Exception releasing " + "remote GNOME_Evolution_Addressbook_BookView interface!\n"); + } - CORBA_exception_free (&ev); + CORBA_exception_free (&ev); + + gtk_object_unref(GTK_OBJECT(book_view)); + } else { + e_book_view_listener_stop (op->listener); + ((EBookBookViewCallback) op->cb) (book, E_BOOK_STATUS_CANCELLED, NULL, op->closure); + } - gtk_object_unref(GTK_OBJECT(book_view)); bonobo_object_unref(BONOBO_OBJECT(op->listener)); - g_free (op); } |