[libsoup] soup-message-queue: hold a reference to the async context
- From: Sergio Villar Senin <svillar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] soup-message-queue: hold a reference to the async context
- Date: Mon, 4 Mar 2013 14:36:36 +0000 (UTC)
commit 6c24fd0e6d3d6a1b18829e72e2508ad6fcf6f9e7
Author: Sergio Villar Senin <svillar igalia com>
Date: Mon Mar 4 11:26:17 2013 +0100
soup-message-queue: hold a reference to the async context
This will ensure that the GMainContext is not freed at least until we get
rid of the queue item. This was causing crashes when synchronously
retrieving resources in WebKit as it uses a different GMainContext for each
of those synchronous requests.
https://bugzilla.gnome.org/show_bug.cgi?id=694920
libsoup/soup-message-queue.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-message-queue.c b/libsoup/soup-message-queue.c
index c7661d8..8b1ebaf 100644
--- a/libsoup/soup-message-queue.c
+++ b/libsoup/soup-message-queue.c
@@ -82,6 +82,8 @@ soup_message_queue_append (SoupMessageQueue *queue, SoupMessage *msg,
item = g_slice_new0 (SoupMessageQueueItem);
item->session = g_object_ref (queue->session);
item->async_context = soup_session_get_async_context (item->session);
+ if (item->async_context)
+ g_main_context_ref (item->async_context);
item->queue = queue;
item->msg = g_object_ref (msg);
item->callback = callback;
@@ -163,6 +165,7 @@ soup_message_queue_item_unref (SoupMessageQueueItem *item)
g_object_unref (item->msg);
g_object_unref (item->cancellable);
g_clear_object (&item->task);
+ g_clear_pointer (&item->async_context, g_main_context_unref);
if (item->io_source) {
g_source_destroy (item->io_source);
g_source_unref (item->io_source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]