[anjuta] symbol-db: Fixes regression crashes
- From: Naba Kumar <naba src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] symbol-db: Fixes regression crashes
- Date: Sat, 20 Feb 2010 23:26:27 +0000 (UTC)
commit 7eb1399a772c61dd910688bf6cf39ea7c210564d
Author: Naba Kumar <naba gnome org>
Date: Sun Feb 21 01:24:39 2010 +0200
symbol-db: Fixes regression crashes
Makes sure canceled data-arrived callback is really suppressed because there was still race
in emitting it from sdbc through idle loop even after canceled. Makes sure cancellable signal
is disconnected since we don't know the life time of it (comes from outside) and could
get reused in different context. These seems to fixes some crashes during failed cancellation.
.../language-support-cpp-java/cpp-java-assist.c | 6 +-
plugins/symbol-db/symbol-db-iface.c | 40 +++++++++++++++++---
2 files changed, 37 insertions(+), 9 deletions(-)
---
diff --git a/plugins/language-support-cpp-java/cpp-java-assist.c b/plugins/language-support-cpp-java/cpp-java-assist.c
index 1ab7ec4..0d4415d 100644
--- a/plugins/language-support-cpp-java/cpp-java-assist.c
+++ b/plugins/language-support-cpp-java/cpp-java-assist.c
@@ -79,9 +79,9 @@ struct _CppJavaAssistPriv {
gboolean editor_only;
IAnjutaIterable* start_iter;
- gboolean async_file : 1;
- gboolean async_system : 1;
- gboolean async_project : 1;
+ gboolean async_file;
+ gboolean async_system;
+ gboolean async_project;
GCancellable* cancel_system;
GCancellable* cancel_file;
diff --git a/plugins/symbol-db/symbol-db-iface.c b/plugins/symbol-db/symbol-db-iface.c
index 32776bc..91380c1 100644
--- a/plugins/symbol-db/symbol-db-iface.c
+++ b/plugins/symbol-db/symbol-db-iface.c
@@ -346,6 +346,15 @@ on_sdb_search_command_data_arrived (AnjutaCommand *command,
guint cmd_id;
sdbsc = SYMBOL_DB_SEARCH_COMMAND (command);
+
+ /* If the command is canceled, don't bother with the callback.
+ * Blocking the data-arrived signal in SymbolDBSearchCommand doesn't
+ * seem to be enough because this signal can get emitted in idle
+ * loop before cancel happened.
+ */
+ if (symbol_db_search_command_get_cancelled (sdbsc))
+ return;
+
iterator = symbol_db_search_command_get_iterator_result (sdbsc);
/* get the previously saved cmd_id and callback data */
@@ -364,6 +373,23 @@ on_sdb_search_command_finished (SymbolDBSearchCommand *search_command,
anjuta_async_notify_notify_finished (notify);
}
+static void
+on_sdb_search_command_cancelled (GCancellable *cancellable,
+ AnjutaCommand *command)
+{
+ g_message ("Cancelling symbol search command wit %p", command);
+ anjuta_command_cancel (command);
+
+ /* Since cancellable is external object, we need to clean our part
+ * to not possibily get spurious callbacks when the cancellable is
+ * reused in different context
+ */
+ g_signal_handlers_disconnect_by_func (cancellable,
+ on_sdb_search_command_cancelled,
+ command);
+ g_object_unref (cancellable);
+}
+
static gint
do_search_prj_glb_async (SymbolDBSearchCommand *search_command, guint cmd_id,
GCancellable* cancel, AnjutaAsyncNotify *notify,
@@ -394,9 +420,10 @@ do_search_prj_glb_async (SymbolDBSearchCommand *search_command, guint cmd_id,
if (cancel)
{
- g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
- G_CALLBACK (anjuta_command_cancel),
- search_command);
+ g_object_ref (cancel);
+ g_signal_connect (G_OBJECT (cancel), "cancelled",
+ G_CALLBACK (on_sdb_search_command_cancelled),
+ search_command);
}
if (notify)
@@ -606,9 +633,10 @@ isymbol_manager_search_file_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType m
if (cancel)
{
- g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
- G_CALLBACK (anjuta_command_cancel),
- search_command);
+ g_object_ref (cancel);
+ g_signal_connect (G_OBJECT (cancel), "cancelled",
+ G_CALLBACK (on_sdb_search_command_cancelled),
+ search_command);
}
if (notify)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]