[epiphany] ephy-history-service: fix race-condition



commit 8415282998dea92b550943321c1f6c5b01f77040
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Fri Dec 20 16:58:38 2013 +0200

    ephy-history-service: fix race-condition
    
    Database shouldn't be accessed from the main thread.

 lib/history/ephy-history-service.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index af4a238..7ae37e3 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -347,15 +347,7 @@ ephy_history_service_send_message (EphyHistoryService *self, EphyHistoryServiceM
 {
   EphyHistoryServicePrivate *priv = self->priv;
 
-  if (priv->history_database)
-    g_async_queue_push_sorted (priv->queue, message, (GCompareDataFunc)sort_messages, NULL);
-  else {
-    message->result = NULL;
-    message->success = FALSE;
-    if (message->callback)
-      message->callback (message->service, message->success, message->result, message->user_data);
-    ephy_history_service_message_free (message);
-  }
+  g_async_queue_push_sorted (priv->queue, message, (GCompareDataFunc)sort_messages, NULL);
 }
 
 static void
@@ -1282,7 +1274,10 @@ ephy_history_service_process_message (EphyHistoryService *self,
 
   method = methods[message->type];
   message->result = NULL;
-  message->success = method (message->service, message->method_argument, &message->result);
+  if (message->service->priv->history_database)
+    message->success = method (message->service, message->method_argument, &message->result);
+  else
+    message->success = FALSE;
 
   if (message->callback || message->type == CLEAR)
     g_idle_add ((GSourceFunc)ephy_history_service_execute_job_callback, message);


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