evolution-data-server/patch-for-random-eds-addr-crashes.patch

385 lines
16 KiB
Diff
Raw Normal View History

--- addressbook/backends/groupwise/e-book-backend-groupwise.c.orig 2006-01-10 08:54:45.000000000 +0100
+++ addressbook/backends/groupwise/e-book-backend-groupwise.c 2006-03-23 16:10:25.226981271 +0100
@@ -2330,6 +2330,8 @@ static EDataBookView *
find_book_view (EBookBackendGroupwise *ebgw)
{
EList *views = e_book_backend_get_book_views (E_BOOK_BACKEND (ebgw));
+ if (!views)
+ return NULL;
EIterator *iter = e_list_get_iterator (views);
EDataBookView *rv = NULL;
@@ -2348,28 +2350,28 @@ find_book_view (EBookBackendGroupwise *e
static void
add_sequence_to_cache (EBookBackendCache *cache,
- guint first_sequence,
- guint last_sequence,
- guint last_po_rebuild_time)
+ gdouble first_sequence,
+ gdouble last_sequence,
+ gdouble last_po_rebuild_time)
{
gchar *tmp;
/* This is the system address book. Let try add the sequence to maintain deltas */
- tmp = g_strdup_printf("%d", first_sequence);
+ tmp = g_strdup_printf("%lf", first_sequence);
if (!e_file_cache_get_object (E_FILE_CACHE(cache), "firstSequence"))
e_file_cache_add_object (E_FILE_CACHE(cache), "firstSequence", tmp);
else
e_file_cache_replace_object (E_FILE_CACHE(cache), "firstSequence", tmp);
g_free (tmp);
- tmp = g_strdup_printf("%d", last_sequence);
+ tmp = g_strdup_printf("%lf", last_sequence);
if (!e_file_cache_get_object (E_FILE_CACHE(cache), "lastSequence"))
e_file_cache_add_object (E_FILE_CACHE(cache), "lastSequence", tmp);
else
e_file_cache_replace_object (E_FILE_CACHE(cache), "lastSequence", tmp);
g_free (tmp);
- tmp = g_strdup_printf("%d", last_po_rebuild_time);
+ tmp = g_strdup_printf("%lf", last_po_rebuild_time);
if (!e_file_cache_get_object (E_FILE_CACHE(cache), "lastTimePORebuild"))
e_file_cache_add_object (E_FILE_CACHE(cache), "lastTimePORebuild", tmp);
else
@@ -2439,6 +2441,10 @@ build_cache (EBookBackendGroupwise *ebgw
GTimeVal tstart, tend;
unsigned long diff;
+ if(!ebgw)
+ return FALSE;
+
+ printf("build cache\n");
if (enable_debug) {
g_get_current_time(&start);
printf("Building the cache for %s \n", ebgw->priv->book_name);
@@ -2456,10 +2462,11 @@ build_cache (EBookBackendGroupwise *ebgw
if (book_view) {
closure = get_closure (book_view);
bonobo_object_ref (book_view);
-
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
+ if (closure) {
+ g_mutex_lock (closure->mutex);
+ g_cond_signal (closure->cond);
+ g_mutex_unlock (closure->mutex);
+ }
}
e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache));
@@ -2590,6 +2597,10 @@ update_cache (EBookBackendGroupwise *ebg
GTimeVal start, end;
unsigned long diff;
+ if (!ebgw)
+ return FALSE;
+
+ printf("Inside update cache\n");
if (enable_debug) {
g_get_current_time(&start);
printf("updating cache for %s\n", ebgw->priv->book_name);
@@ -2599,10 +2610,11 @@ update_cache (EBookBackendGroupwise *ebg
if (book_view) {
closure = get_closure (book_view);
bonobo_object_ref (book_view);
-
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
+ if (closure) {
+ g_mutex_lock (closure->mutex);
+ g_cond_signal (closure->cond);
+ g_mutex_unlock (closure->mutex);
+ }
}
cache_file_name = e_file_cache_get_filename (E_FILE_CACHE(ebgw->priv->cache));
@@ -2680,7 +2692,6 @@ update_cache (EBookBackendGroupwise *ebg
printf("updating the cache for %s complated in %ld.%03ld seconds for %d contacts\n",
ebgw->priv->book_name, diff / 1000, diff % 1000, contact_num);
}
-
return FALSE;
}
@@ -2688,8 +2699,8 @@ static gboolean
update_address_book_deltas (EBookBackendGroupwise *ebgw)
{
int status, contact_num = 0;
- guint server_first_sequence = -1, server_last_sequence = -1, server_last_po_rebuild_time = -1;
- guint cache_last_sequence = -1, cache_last_po_rebuild_time = -1;
+ gdouble server_first_sequence = -1, server_last_sequence = -1, server_last_po_rebuild_time = -1;
+ gdouble cache_last_sequence = -1, cache_last_po_rebuild_time = -1;
const char *cache_obj;
char *tmp, *count, *sequence, *status_msg;
GList *add_list = NULL, *delete_list = NULL;
@@ -2697,6 +2708,9 @@ update_address_book_deltas (EBookBackend
EDataBookView *book_view;
GroupwiseBackendSearchClosure *closure;
+ if (!ebgw)
+ return FALSE;
+
EBookBackendGroupwisePrivate *priv = ebgw->priv;
EBookBackendCache *cache = priv->cache;
@@ -2727,11 +2741,11 @@ update_address_book_deltas (EBookBackend
/* Read the last sequence and last poa rebuild time from cache */
cache_obj = e_file_cache_get_object (E_FILE_CACHE (cache), "lastSequence");
if (cache_obj)
- cache_last_sequence = atoi (cache_obj);
+ cache_last_sequence = strtod (cache_obj, NULL);
cache_obj = e_file_cache_get_object (E_FILE_CACHE (cache), "lastTimePORebuild");
if (cache_obj)
- cache_last_po_rebuild_time = atoi (cache_obj);
+ cache_last_po_rebuild_time = strtod (cache_obj, NULL);
/* check whether the all the sequences are available and also whether the PO is rebuilt */
if (server_first_sequence > cache_last_sequence || cache_last_sequence == -1 ||
@@ -2758,14 +2772,15 @@ update_address_book_deltas (EBookBackend
if (book_view) {
closure = get_closure (book_view);
bonobo_object_ref (book_view);
-
- g_mutex_lock (closure->mutex);
- g_cond_signal (closure->cond);
- g_mutex_unlock (closure->mutex);
+ if (closure){
+ g_mutex_lock (closure->mutex);
+ g_cond_signal (closure->cond);
+ g_mutex_unlock (closure->mutex);
+ }
}
/* update the cache */
- sequence = g_strdup_printf ("%d", cache_last_sequence +1);
+ sequence = g_strdup_printf ("%lf", cache_last_sequence +1);
count = g_strdup_printf ("%d", CURSOR_ITEM_LIMIT);
/* load summary file */
@@ -2782,6 +2797,7 @@ update_address_book_deltas (EBookBackend
e_file_cache_freeze_changes (E_FILE_CACHE (cache));
while (cache_last_sequence < server_last_sequence) {
+ printf("Calling get_items_delta\n");
e_gw_connection_get_items_delta (priv->cnc,
ebgw->priv->container_id,
"name email sync", count,
@@ -2793,6 +2809,8 @@ update_address_book_deltas (EBookBackend
printf("sequence differs but no changes found !!!\n");
break;
}
+ printf("add_list size:%d\n", g_list_length(add_list));
+ printf("delete_list size:%d\n", g_list_length(delete_list));
for (; add_list != NULL; add_list = g_list_next(add_list)) {
const char *id;
@@ -2861,15 +2879,15 @@ update_address_book_deltas (EBookBackend
/* cache is updated, now adding the sequence information to the cache */
- tmp = g_strdup_printf("%d", server_first_sequence);
+ tmp = g_strdup_printf("%lf", server_first_sequence);
e_file_cache_replace_object (E_FILE_CACHE(cache), "firstSequence", tmp);
g_free (tmp);
- tmp = g_strdup_printf("%d", server_last_sequence);
+ tmp = g_strdup_printf("%lf", server_last_sequence);
e_file_cache_replace_object (E_FILE_CACHE(cache), "lastSequence", tmp);
g_free (tmp);
- tmp = g_strdup_printf("%d", server_last_po_rebuild_time);
+ tmp = g_strdup_printf("%lf", server_last_po_rebuild_time);
e_file_cache_replace_object (E_FILE_CACHE(cache), "lastTimePORebuild", tmp);
g_free (tmp);
@@ -2940,7 +2958,7 @@ e_book_backend_groupwise_authenticate_us
gboolean is_writable;
const char *cache_refresh_interval_set;
int cache_refresh_interval = CACHE_REFRESH_INTERVAL;
-
+
printf ("authenticate user ............\n");
ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
priv = ebgw->priv;
@@ -2962,6 +2980,7 @@ e_book_backend_groupwise_authenticate_us
case GNOME_Evolution_Addressbook_MODE_REMOTE:
if (priv->cnc) { /*we have already authenticated to server */
+ printf("already authenticated\n");
e_data_book_respond_authenticate_user (book, opid, GNOME_Evolution_Addressbook_Success);
return;
}
@@ -2979,6 +2998,8 @@ e_book_backend_groupwise_authenticate_us
id = NULL;
is_writable = FALSE;
+ if(priv->book_name)
+ printf("book_name:%s\n", priv->book_name);
status = e_gw_connection_get_address_book_id (priv->cnc, priv->book_name, &id, &is_writable);
if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
status = e_gw_connection_get_address_book_id (priv->cnc, priv->book_name, &id, &is_writable);
@@ -3015,17 +3036,23 @@ e_book_backend_groupwise_authenticate_us
SUMMARY_FLUSH_TIMEOUT);
if (e_book_backend_cache_is_populated (priv->cache)) {
- if (priv->is_writable)
+ printf("cache is populated\n");
+ if (priv->is_writable){
+ printf("is writable\n");
+ printf("creating update_cache thread\n");
g_thread_create ((GThreadFunc) update_cache, ebgw, FALSE, NULL);
+ }
else if (priv->marked_for_offline) {
+ printf("marked for offline\n");
GThread *t;
+ printf("creating update_address_book_deltas thread\n");
t = g_thread_create ((GThreadFunc) update_address_book_deltas, ebgw, TRUE, NULL);
/* spawn a thread to update the system address book cache
* at given intervals
*/
- cache_refresh_interval_set = g_getenv ("BOOK_CACHE_REFESH_INTERVAL");
+ cache_refresh_interval_set = g_getenv ("BOOK_CACHE_REFRESH_INTERVAL");
if (cache_refresh_interval_set) {
cache_refresh_interval = g_ascii_strtod (cache_refresh_interval_set,
NULL); /* use this */
@@ -3043,12 +3070,16 @@ e_book_backend_groupwise_authenticate_us
}
else if (priv->is_writable) { /* for personal books we always cache */
/* Personal address book and frequent contacts */
+ printf("else if is _writable");
+ printf("build_cahe thread");
g_thread_create ((GThreadFunc) build_cache, ebgw, FALSE, NULL);
}
else if(priv->marked_for_offline) {
+ printf("else if marked_for_offline\n");
GThread *t;
/* System address book */
/* cache is not populated and book is not writable and marked for offline usage */
+ printf("creating update_address_book_deltas thread\n");
t = g_thread_create ((GThreadFunc) update_address_book_deltas, ebgw, TRUE, NULL);
g_thread_join (t);
/* set the cache refresh time */
@@ -3429,6 +3460,7 @@ e_book_backend_groupwise_init (EBookBack
priv->marked_for_offline = FALSE;
priv->use_ssl = NULL;
priv->cache=NULL;
+ priv->cnc = NULL;
priv->original_uri = NULL;
priv->cache_timeout = 0;
priv->reserved1 = NULL;
--- servers/groupwise/e-gw-connection.c.orig 2006-03-23 16:08:44.842634384 +0100
+++ servers/groupwise/e-gw-connection.c 2006-03-23 16:10:25.228981338 +0100
@@ -685,8 +685,8 @@ e_gw_connection_get_container_id (EGwCon
}
EGwConnectionStatus
-e_gw_connection_get_items_delta_info (EGwConnection *cnc, const char *container, guint *first_sequence,
- guint *last_sequence, guint *last_po_rebuild_time )
+e_gw_connection_get_items_delta_info (EGwConnection *cnc, const char *container, gdouble *first_sequence,
+ gdouble *last_sequence, gdouble *last_po_rebuild_time )
{
SoupSoapMessage *msg;
SoupSoapResponse *response;
@@ -734,21 +734,21 @@ e_gw_connection_get_items_delta_info (EG
subparam = soup_soap_parameter_get_first_child_by_name (param, "firstSequence");
if (subparam)
- *first_sequence = soup_soap_parameter_get_int_value(subparam);
+ *first_sequence = strtod (soup_soap_parameter_get_string_value(subparam), NULL);
else
*first_sequence = -1;
subparam = soup_soap_parameter_get_first_child_by_name (param, "lastSequence");
if (subparam)
- *last_sequence = soup_soap_parameter_get_int_value(subparam);
+ *last_sequence = strtod (soup_soap_parameter_get_string_value(subparam), NULL);
else
*last_sequence = -1;
subparam = soup_soap_parameter_get_first_child_by_name (param, "lastTimePORebuild");
if (subparam)
- *last_po_rebuild_time = soup_soap_parameter_get_int_value(subparam);
+ *last_po_rebuild_time = strtod (soup_soap_parameter_get_string_value(subparam), NULL);
else
*last_po_rebuild_time = -1;
Index: servers/groupwise/e-gw-connection.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.h,v
retrieving revision 1.68
diff -u -p -r1.68 e-gw-connection.h
--- servers/groupwise/e-gw-connection.h 31 Aug 2005 04:26:07 -0000 1.68
+++ servers/groupwise/e-gw-connection.h 20 Mar 2006 14:11:38 -0000
@@ -100,7 +100,7 @@ EGwConnectionStatus e_gw_connection_get_
EGwConnectionStatus e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item, GSList **id_list);
EGwConnectionStatus e_gw_connection_remove_item (EGwConnection *cnc, const char *container, const char *id);
EGwConnectionStatus e_gw_connection_remove_items (EGwConnection *cnc, const char *container, GList *item_ids);
-EGwConnectionStatus e_gw_connection_get_items_delta_info (EGwConnection *cnc, const char *container, guint *first_sequence, guint *last_sequence, guint *last_po_rebuild_time);
+EGwConnectionStatus e_gw_connection_get_items_delta_info (EGwConnection *cnc, const char *container, gdouble *first_sequence, gdouble *last_sequence, gdouble *last_po_rebuild_time);
EGwConnectionStatus e_gw_connection_get_items_delta (EGwConnection *cnc, const char *container, const char *view, const char *count, const char * start_sequence, GList **add_list, GList **delete_list);
--- addressbook/libedata-book/e-data-book.c.orig 2005-05-14 08:36:47.000000000 +0200
+++ addressbook/libedata-book/e-data-book.c 2006-03-23 16:10:48.391753634 +0100
@@ -912,7 +912,7 @@ e_data_book_construct (EDataBook
g_object_ref (source);
- priv->backend = backend;
+ priv->backend = g_object_ref(backend);
priv->source = source;
}
@@ -965,6 +965,7 @@ e_data_book_dispose (GObject *object)
CORBA_exception_free (&ev);
g_object_unref (book->priv->source);
+ g_object_unref (book->priv->backend);
g_free (book->priv);
book->priv = NULL;
}
--- libedataserver/e-list.c.orig 2005-11-17 12:38:47.000000000 +0100
+++ libedataserver/e-list.c 2006-03-23 16:10:48.392753667 +0100
@@ -74,10 +74,11 @@ e_list_duplicate (EList *old)
EIterator *
e_list_get_iterator (EList *list)
{
- EIterator *iterator;
+ EIterator *iterator = NULL;
g_return_val_if_fail (list != NULL, NULL);
iterator = e_list_iterator_new(list);
- list->iterators = g_list_append(list->iterators, iterator);
+ if (iterator)
+ list->iterators = g_list_append(list->iterators, iterator);
return iterator;
}
--- libedataserver/e-list-iterator.c.orig 2005-11-17 12:38:47.000000000 +0100
+++ libedataserver/e-list-iterator.c 2006-03-23 16:10:48.392753667 +0100
@@ -66,11 +66,13 @@ e_list_iterator_init (EListIterator *lis
EIterator *
e_list_iterator_new (EList *list)
{
- EListIterator *iterator;
+ EListIterator *iterator = NULL;
g_return_val_if_fail (list != NULL, NULL);
iterator = g_object_new (E_TYPE_LIST_ITERATOR, NULL);
+ if (!iterator)
+ return NULL;
iterator->list = list;
g_object_ref(list);
iterator->iterator = list->list;