[evolution-patches] 33708 LDAP+local autocompletion



I *think* this fixes the bug (LDAP completions failing to show up
sometimes if you also have another contacts folder enabled for
autocompletion), although since it only happens sporadically, I'll want
to run with the patch for a little while to make sure.

(The specific problem this fixes is a race condition where if the local
contacts folder returns all of its results before the ldap completion
folder even returns a bookview, then the ldap results are discarded.)

Index: e-select-names-completion.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names-completion.c,v
retrieving revision 1.61
diff -u -r1.61 e-select-names-completion.c
--- e-select-names-completion.c	9 Apr 2003 10:15:05 -0000	1.61
+++ e-select-names-completion.c	11 Apr 2003 19:06:34 -0000
@@ -731,13 +731,34 @@
 }
 
 static void
+e_select_names_completion_done (ESelectNamesCompletion *comp)
+{
+	g_free (comp->priv->query_text);
+	comp->priv->query_text = NULL;
+
+	e_completion_end_search (E_COMPLETION (comp)); /* That's all folks! */
+
+	/* Need to launch a new completion if another one is pending. */
+	if (comp->priv->waiting_query) {
+		gchar *s = comp->priv->waiting_query;
+		comp->priv->waiting_query = NULL;
+		e_completion_begin_search (E_COMPLETION (comp), s, comp->priv->waiting_pos, comp->priv->waiting_limit);
+		g_free (s);
+	}
+}
+
+static void
 e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBookView *view, gpointer user_data)
 {
 	ESelectNamesCompletion *comp;
 	ESelectNamesCompletionBookData *book_data;
 
-	if (status != E_BOOK_STATUS_SUCCESS)
+	if (status != E_BOOK_STATUS_SUCCESS) {
+		comp->priv->pending_completion_seq--;
+		if (!comp->priv->pending_completion_seq)
+			e_select_names_completion_done (comp);
 		return;
+	}
 
 	book_data = (ESelectNamesCompletionBookData*)user_data;
 	comp = book_data->comp;
@@ -772,7 +793,6 @@
 				  G_CALLBACK (e_select_names_completion_seq_complete_cb),
 				  book_data);
 	book_data->sequence_complete_received = FALSE;
-	comp->priv->pending_completion_seq++;
 }
 
 static void
@@ -842,18 +862,7 @@
 			return;
 	}
 
-	g_free (comp->priv->query_text);
-	comp->priv->query_text = NULL;
-
-	e_completion_end_search (E_COMPLETION (comp)); /* That's all folks! */
-
-	/* Need to launch a new completion if another one is pending. */
-	if (comp->priv->waiting_query) {
-		gchar *s = comp->priv->waiting_query;
-		comp->priv->waiting_query = NULL;
-		e_completion_begin_search (E_COMPLETION (comp), s, comp->priv->waiting_pos, comp->priv->waiting_limit);
-		g_free (s);
-	}
+	e_select_names_completion_done (comp);
 }
 
 static void
@@ -975,6 +984,7 @@
 											       e_select_names_completion_got_book_view_cb, book_data);
 					if (! book_data->book_view_tag)
 						g_warning ("Exception calling e_book_get_completion_view");
+					comp->priv->pending_completion_seq++;
 				}
 
 				if (out)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]