aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-07-24 01:52:53 +0800
committerDan Winship <danw@src.gnome.org>2001-07-24 01:52:53 +0800
commitc0c2e3fbdad5f8e3bac4ef7a5ec01dd51b902aea (patch)
tree2bc69aba300e356e82583f9ac3b51fe3160c808b
parentd5a23e61317166119b33b9a52bcbb7502f636028 (diff)
downloadgsoc2013-evolution-c0c2e3fbdad5f8e3bac4ef7a5ec01dd51b902aea.tar
gsoc2013-evolution-c0c2e3fbdad5f8e3bac4ef7a5ec01dd51b902aea.tar.gz
gsoc2013-evolution-c0c2e3fbdad5f8e3bac4ef7a5ec01dd51b902aea.tar.bz2
gsoc2013-evolution-c0c2e3fbdad5f8e3bac4ef7a5ec01dd51b902aea.tar.lz
gsoc2013-evolution-c0c2e3fbdad5f8e3bac4ef7a5ec01dd51b902aea.tar.xz
gsoc2013-evolution-c0c2e3fbdad5f8e3bac4ef7a5ec01dd51b902aea.tar.zst
gsoc2013-evolution-c0c2e3fbdad5f8e3bac4ef7a5ec01dd51b902aea.zip
Re-fix for my 07-18 not-quite-fix.
* backend/ebook/e-book-listener.c: Add a "stopped" flag like EBookViewListener. (e_book_listener_check_queue): Don't emit signals if the listener is stopped. (e_book_listener_queue_generic_response, etc): Don't queue responses if the listener is stopped. (e_book_listener_stop): Flush the queue and stop queue/emitting further responses. * backend/ebook/e-book.c (e_book_unload_uri): Revert the previous change and call e_book_listener_stop() instead. * backend/ebook/e-book-view-listener.c (e_book_view_listener_stop): When removing an idle handler, unref the listener as well, since e_book_view_listener_queue_response will have ref'ed it. svn path=/trunk/; revision=11306
-rw-r--r--addressbook/ChangeLog21
-rw-r--r--addressbook/backend/ebook/e-book-listener.c65
-rw-r--r--addressbook/backend/ebook/e-book-listener.h1
-rw-r--r--addressbook/backend/ebook/e-book-view-listener.c1
-rw-r--r--addressbook/backend/ebook/e-book.c4
5 files changed, 84 insertions, 8 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index e2c01bfafa..9d3bed3211 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,24 @@
+2001-07-23 Dan Winship <danw@ximian.com>
+
+ Re-fix for my 07-18 not-quite-fix.
+
+ * backend/ebook/e-book-listener.c: Add a "stopped" flag like
+ EBookViewListener.
+ (e_book_listener_check_queue): Don't emit signals if the listener
+ is stopped.
+ (e_book_listener_queue_generic_response, etc): Don't queue
+ responses if the listener is stopped.
+ (e_book_listener_stop): Flush the queue and stop queue/emitting
+ further responses.
+
+ * backend/ebook/e-book.c (e_book_unload_uri): Revert the previous
+ change and call e_book_listener_stop() instead.
+
+ * backend/ebook/e-book-view-listener.c
+ (e_book_view_listener_stop): When removing an idle handler, unref
+ the listener as well, since e_book_view_listener_queue_response
+ will have ref'ed it.
+
2001-07-22 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook-component.c (remove_folder): Add a
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index fd3efd3039..87ea5f874f 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -28,11 +28,18 @@ POA_GNOME_Evolution_Addressbook_BookListener__vepv e_book_listener_vepv;
struct _EBookListenerPrivate {
GList *response_queue;
gint idle_id;
+
+ guint stopped : 1;
};
static gboolean
e_book_listener_check_queue (EBookListener *listener)
{
+ if (listener->priv->stopped) {
+ listener->priv->idle_id = 0;
+ return FALSE;
+ }
+
if (listener->priv->response_queue != NULL) {
gtk_signal_emit (GTK_OBJECT (listener),
e_book_listener_signals [RESPONSES_QUEUED]);
@@ -77,6 +84,9 @@ e_book_listener_queue_generic_response (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = op;
@@ -92,6 +102,9 @@ e_book_listener_queue_open_response (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = OpenBookResponse;
@@ -108,6 +121,9 @@ e_book_listener_queue_open_progress (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = OpenProgressEvent;
@@ -125,6 +141,9 @@ e_book_listener_queue_create_card_response (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = CreateCardResponse;
@@ -141,6 +160,9 @@ e_book_listener_queue_get_cursor_response (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = GetCursorResponse;
@@ -157,6 +179,9 @@ e_book_listener_queue_get_view_response (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = GetBookViewResponse;
@@ -173,6 +198,9 @@ e_book_listener_queue_get_changes_response (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = GetChangesResponse;
@@ -188,6 +216,9 @@ e_book_listener_queue_link_status (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = LinkStatusEvent;
@@ -202,6 +233,9 @@ e_book_listener_queue_writable_status (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = WritableStatusEvent;
@@ -216,6 +250,9 @@ e_book_listener_queue_authentication_response (EBookListener *listener,
{
EBookListenerResponse *resp;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = AuthenticationResponse;
@@ -232,6 +269,9 @@ e_book_listener_queue_get_supported_fields_response (EBookListener *listener,
EBookListenerResponse *resp;
int i;
+ if (listener->priv->stopped)
+ return;
+
resp = g_new0 (EBookListenerResponse, 1);
resp->op = GetSupportedFieldsResponse;
@@ -571,11 +611,13 @@ e_book_listener_init (EBookListener *listener)
listener->priv = g_new0 (EBookListenerPrivate, 1);
}
-static void
-e_book_listener_destroy (GtkObject *object)
+void
+e_book_listener_stop (EBookListener *listener)
{
- EBookListener *listener = E_BOOK_LISTENER (object);
- GList *l;
+ GList *l;
+
+ if (listener->priv->stopped)
+ return;
for (l = listener->priv->response_queue; l != NULL; l = l->next) {
EBookListenerResponse *resp = l->data;
@@ -634,10 +676,23 @@ e_book_listener_destroy (GtkObject *object)
g_free (resp);
}
g_list_free (listener->priv->response_queue);
+ listener->priv->response_queue = NULL;
- if (listener->priv->idle_id)
+ if (listener->priv->idle_id) {
g_source_remove (listener->priv->idle_id);
+ listener->priv->idle_id = 0;
+ bonobo_object_unref (BONOBO_OBJECT (listener));
+ }
+
+ listener->priv->stopped = TRUE;
+}
+
+static void
+e_book_listener_destroy (GtkObject *object)
+{
+ EBookListener *listener = E_BOOK_LISTENER (object);
+ e_book_listener_stop (listener);
g_free (listener->priv);
GTK_OBJECT_CLASS (e_book_listener_parent_class)->destroy (object);
diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h
index acd9645f3b..16cb518ce5 100644
--- a/addressbook/backend/ebook/e-book-listener.h
+++ b/addressbook/backend/ebook/e-book-listener.h
@@ -92,6 +92,7 @@ EBookListener *e_book_listener_new (void);
int e_book_listener_check_pending (EBookListener *listener);
EBookListenerResponse *e_book_listener_pop_response (EBookListener *listener);
GtkType e_book_listener_get_type (void);
+void e_book_listener_stop (EBookListener *listener);
POA_GNOME_Evolution_Addressbook_BookListener__epv *e_book_listener_get_epv (void);
diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c
index 16dc1a8ed8..705cc155c8 100644
--- a/addressbook/backend/ebook/e-book-view-listener.c
+++ b/addressbook/backend/ebook/e-book-view-listener.c
@@ -367,6 +367,7 @@ e_book_view_listener_stop (EBookViewListener *listener)
if (listener->priv->idle_id) {
g_source_remove(listener->priv->idle_id);
listener->priv->idle_id = 0;
+ bonobo_object_unref (BONOBO_OBJECT (listener));
}
for (l = listener->priv->response_queue; l != NULL; l = l->next) {
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 3bd13ea4ff..73b39b6c46 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -531,7 +531,6 @@ void
e_book_unload_uri (EBook *book)
{
CORBA_Environment ev;
- EBookListenerResponse *resp;
g_return_if_fail (book != NULL);
g_return_if_fail (E_IS_BOOK (book));
@@ -559,8 +558,7 @@ e_book_unload_uri (EBook *book)
CORBA_exception_free (&ev);
- while ((resp = e_book_listener_pop_response (book->priv->listener)))
- g_free (resp);
+ e_book_listener_stop (book->priv->listener);
bonobo_object_unref (BONOBO_OBJECT (book->priv->listener));
book->priv->listener = NULL;