aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-12 12:06:30 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-12 12:06:30 +0800
commit83f816df158441ca750b0bc12b7ccab2d43c0e43 (patch)
tree62e82d7236bb0bbbc9ecc2ec2e3feb6180402d0f
parentd7aee7e7edfe1d76beba4246f50510479af955a7 (diff)
downloadgsoc2013-evolution-83f816df158441ca750b0bc12b7ccab2d43c0e43.tar.gz
gsoc2013-evolution-83f816df158441ca750b0bc12b7ccab2d43c0e43.tar.zst
gsoc2013-evolution-83f816df158441ca750b0bc12b7ccab2d43c0e43.zip
guard against multiple invocations.
2002-11-11 Chris Toshok <toshok@ximian.com> * backend/pas/pas-card-cursor.c (pas_card_cursor_dispose): guard against multiple invocations. * backend/pas/pas-backend-ldap.c (view_destroy): change signature to that of a weak ref notify function. (cursor_destroy): same. (pas_backend_ldap_book_destroy_cb): same. (get_cursor_handler): ::destroy -> weak_ref. (pas_backend_ldap_process_get_book_view): same. (pas_backend_ldap_add_client): same. * backend/pas/pas-backend-file.c (cursor_destroy): change signature to that of a weak ref notify function. (view_destroy): same. (pas_backend_file_book_destroy_cb): same. (pas_backend_file_process_get_cursor): ::destroy -> weak_ref. (pas_backend_file_process_get_book_view): same. (pas_backend_file_process_get_completion_view): same. (pas_backend_file_process_get_changes): same. (pas_backend_file_add_client): same. * backend/ebook/test-client.c (get_cursor_cb): unref the book and exit here. (get_card_cb): pass a query string to get_cursor. * backend/ebook/e-book-view.c (e_book_view_class_init): correct marshaller for "card_added". svn path=/trunk/; revision=18720
-rw-r--r--addressbook/ChangeLog30
-rw-r--r--addressbook/backend/ebook/e-book-view.c4
-rw-r--r--addressbook/backend/ebook/test-client.c5
-rw-r--r--addressbook/backend/pas/pas-backend-file.c30
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c25
-rw-r--r--addressbook/backend/pas/pas-card-cursor.c7
6 files changed, 63 insertions, 38 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index cdd0a9650c..4dc908e68b 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,35 @@
2002-11-11 Chris Toshok <toshok@ximian.com>
+ * backend/pas/pas-card-cursor.c (pas_card_cursor_dispose): guard
+ against multiple invocations.
+
+ * backend/pas/pas-backend-ldap.c (view_destroy): change signature
+ to that of a weak ref notify function.
+ (cursor_destroy): same.
+ (pas_backend_ldap_book_destroy_cb): same.
+ (get_cursor_handler): ::destroy -> weak_ref.
+ (pas_backend_ldap_process_get_book_view): same.
+ (pas_backend_ldap_add_client): same.
+
+ * backend/pas/pas-backend-file.c (cursor_destroy): change
+ signature to that of a weak ref notify function.
+ (view_destroy): same.
+ (pas_backend_file_book_destroy_cb): same.
+ (pas_backend_file_process_get_cursor): ::destroy -> weak_ref.
+ (pas_backend_file_process_get_book_view): same.
+ (pas_backend_file_process_get_completion_view): same.
+ (pas_backend_file_process_get_changes): same.
+ (pas_backend_file_add_client): same.
+
+ * backend/ebook/test-client.c (get_cursor_cb): unref the book and
+ exit here.
+ (get_card_cb): pass a query string to get_cursor.
+
+ * backend/ebook/e-book-view.c (e_book_view_class_init): correct
+ marshaller for "card_added".
+
+2002-11-11 Chris Toshok <toshok@ximian.com>
+
* gui/widgets/test-reflow.c (destroy_callback): change signature
to that of a weak ref notify function.
(main): ::destroy -> weak_ref.
diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c
index 68c73e06f7..007f052297 100644
--- a/addressbook/backend/ebook/e-book-view.c
+++ b/addressbook/backend/ebook/e-book-view.c
@@ -286,9 +286,9 @@ e_book_view_class_init (EBookViewClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EBookViewClass, card_added),
NULL, NULL,
- e_book_marshal_NONE__STRING,
+ e_book_marshal_NONE__POINTER,
G_TYPE_NONE, 1,
- G_TYPE_STRING);
+ G_TYPE_POINTER);
e_book_view_signals [CARD_REMOVED] =
g_signal_new ("card_removed",
diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c
index 8d44cb73e0..0ed9290759 100644
--- a/addressbook/backend/ebook/test-client.c
+++ b/addressbook/backend/ebook/test-client.c
@@ -50,6 +50,9 @@ get_cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer cl
g_free(vcard);
g_object_unref(card);
}
+
+ g_object_unref (book);
+ exit(0);
}
static void
@@ -62,7 +65,7 @@ get_card_cb (EBook *book, EBookStatus status, ECard *card, gpointer closure)
g_free(vcard);
printf ("Getting cards..\n");
- e_book_get_cursor(book, "", get_cursor_cb, NULL);
+ e_book_get_cursor(book, "(contains \"x-evolution-any-field\" \"\")", get_cursor_cb, NULL);
printf ("Done getting all cards.\n");
}
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index ff8f9802a1..bc5de01458 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -271,7 +271,7 @@ get_nth(PASCardCursor *cursor, long n, gpointer data)
}
static void
-cursor_destroy(GObject *object, gpointer data)
+cursor_destroy(gpointer data, GObject *where_object_was)
{
CORBA_Environment ev;
GNOME_Evolution_Addressbook_Book corba_book;
@@ -297,7 +297,7 @@ cursor_destroy(GObject *object, gpointer data)
}
static void
-view_destroy(GObject *object, gpointer data)
+view_destroy(gpointer data, GObject *where_object_was)
{
PASBook *book = (PASBook *)data;
PASBackendFile *bf;
@@ -307,7 +307,7 @@ view_destroy(GObject *object, gpointer data)
bf = PAS_BACKEND_FILE(pas_book_get_backend(book));
for (iterator = e_list_get_iterator(bf->priv->book_views); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
const PASBackendFileBookView *view = e_iterator_get(iterator);
- if (view->book_view == PAS_BOOK_VIEW(object)) {
+ if (view->book_view == (PASBookView*)where_object_was) {
e_iterator_delete(iterator);
success = TRUE;
break;
@@ -970,8 +970,8 @@ pas_backend_file_process_get_cursor (PASBackend *backend,
get_nth,
cursor_data);
- g_signal_connect(cursor, "destroy",
- G_CALLBACK(cursor_destroy), cursor_data);
+ g_object_weak_ref (G_OBJECT (cursor),
+ cursor_destroy, cursor_data);
pas_book_respond_get_cursor (
book,
@@ -997,8 +997,7 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- g_signal_connect(book_view, "destroy",
- G_CALLBACK(view_destroy), book);
+ g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
view.book_view = book_view;
view.search = g_strdup (req->search);
@@ -1036,8 +1035,7 @@ pas_backend_file_process_get_completion_view (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- g_signal_connect(book_view, "destroy",
- G_CALLBACK(view_destroy), book);
+ g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
view.book_view = book_view;
view.search = g_strdup (req->search);
@@ -1076,8 +1074,7 @@ pas_backend_file_process_get_changes (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- g_signal_connect(book_view, "destroy",
- G_CALLBACK(view_destroy), book);
+ g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
pas_book_respond_get_changes (book,
(book_view != NULL
@@ -1221,13 +1218,11 @@ pas_backend_file_process_client_requests (PASBook *book)
}
static void
-pas_backend_file_book_destroy_cb (PASBook *book, gpointer data)
+pas_backend_file_book_destroy_cb (gpointer data, GObject *where_book_was)
{
- PASBackendFile *backend;
-
- backend = PAS_BACKEND_FILE (data);
+ PASBackendFile *backend = PAS_BACKEND_FILE (data);
- pas_backend_remove_client (PAS_BACKEND (backend), book);
+ pas_backend_remove_client (PAS_BACKEND (backend), (PASBook*)where_book_was);
}
/*
@@ -1522,8 +1517,7 @@ pas_backend_file_add_client (PASBackend *backend,
return FALSE;
}
- g_signal_connect (book, "destroy",
- G_CALLBACK (pas_backend_file_book_destroy_cb), backend);
+ g_object_weak_ref (G_OBJECT (book), pas_backend_file_book_destroy_cb, backend);
g_signal_connect (book, "requests_queued",
G_CALLBACK (pas_backend_file_process_client_requests), NULL);
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 010e8d104e..3e56e02146 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -291,7 +291,7 @@ remove_view (int msgid, LDAPOp *op, PASBookView *view)
}
static void
-view_destroy(GObject *object, gpointer data)
+view_destroy(gpointer data, GObject *where_object_was)
{
PASBook *book = (PASBook *)data;
PASBackendLDAP *bl;
@@ -304,7 +304,7 @@ view_destroy(GObject *object, gpointer data)
while (e_iterator_is_valid (iter)) {
PASBackendLDAPBookView *view = (PASBackendLDAPBookView*)e_iterator_get (iter);
- if (view->book_view == PAS_BOOK_VIEW(object)) {
+ if (view->book_view == (PASBookView*)where_object_was) {
GNOME_Evolution_Addressbook_Book corba_book;
CORBA_Environment ev;
@@ -1718,7 +1718,7 @@ get_nth(PASCardCursor *cursor, long n, gpointer data)
}
static void
-cursor_destroy(GObject *object, gpointer data)
+cursor_destroy(gpointer data, GObject *where_object_was)
{
PASBackendLDAPCursorPrivate *cursor_data = (PASBackendLDAPCursorPrivate *) data;
@@ -1784,8 +1784,7 @@ get_cursor_handler (LDAPOp *op, LDAPMessage *res)
get_nth,
cursor_op->cursor_data);
- g_signal_connect(cursor, "destroy",
- G_CALLBACK(cursor_destroy), cursor_op->cursor_data);
+ g_object_weak_ref (G_OBJECT (cursor), cursor_destroy, cursor_op->cursor_data);
cursor_op->responded = TRUE;
}
@@ -1811,7 +1810,7 @@ get_cursor_dtor (LDAPOp *op)
LDAPGetCursorOp *cursor_op = (LDAPGetCursorOp*)op;
if (!cursor_op->responded) {
- cursor_destroy (NULL, cursor_op->cursor_data);
+ cursor_destroy (cursor_op->cursor_data, NULL);
}
g_free (op);
@@ -3038,8 +3037,7 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend,
book_view = pas_book_view_new (req->get_book_view.listener);
bonobo_object_ref(BONOBO_OBJECT(book));
- g_signal_connect(book_view, "destroy",
- G_CALLBACK (view_destroy), book);
+ g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
view = g_new0(PASBackendLDAPBookView, 1);
view->book_view = book_view;
@@ -3214,13 +3212,11 @@ pas_backend_ldap_process_client_requests (PASBook *book)
}
static void
-pas_backend_ldap_book_destroy_cb (PASBook *book, gpointer data)
+pas_backend_ldap_book_destroy_cb (gpointer data, GObject *where_book_was)
{
- PASBackendLDAP *backend;
-
- backend = PAS_BACKEND_LDAP (data);
+ PASBackendLDAP *backend = PAS_BACKEND_LDAP (data);
- pas_backend_remove_client (PAS_BACKEND (backend), book);
+ pas_backend_remove_client (PAS_BACKEND (backend), (PASBook*)where_book_was);
}
static GNOME_Evolution_Addressbook_BookListener_CallStatus
@@ -3335,8 +3331,7 @@ pas_backend_ldap_add_client (PASBackend *backend,
return FALSE;
}
- g_signal_connect (book, "destroy",
- G_CALLBACK (pas_backend_ldap_book_destroy_cb), backend);
+ g_object_weak_ref (G_OBJECT (book), pas_backend_ldap_book_destroy_cb, backend);
g_signal_connect (book, "requests_queued",
G_CALLBACK (pas_backend_ldap_process_client_requests), NULL);
diff --git a/addressbook/backend/pas/pas-card-cursor.c b/addressbook/backend/pas/pas-card-cursor.c
index 52d8911271..8450a45028 100644
--- a/addressbook/backend/pas/pas-card-cursor.c
+++ b/addressbook/backend/pas/pas-card-cursor.c
@@ -30,10 +30,13 @@ pas_card_cursor_dispose (GObject *object)
{
PASCardCursor *cursor = PAS_CARD_CURSOR (object);
- if ( cursor->priv )
+ if ( cursor->priv ) {
g_free ( cursor->priv );
+ cursor->priv = NULL;
+ }
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
/*