[libsoup] Pop the thread default main context not from the callback but from where it was pushed
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Pop the thread default main context not from the callback but from where it was pushed
- Date: Wed, 7 May 2014 19:19:21 +0000 (UTC)
commit ec83b81fabf6fc0d0be1e30479f150310146ae5c
Author: Sebastian Dröge <sebastian centricular com>
Date: Wed May 7 19:33:43 2014 +0200
Pop the thread default main context not from the callback but from where it was pushed
Based on a patch by Dmitry Shatrov <shatrov gmail com>, see
http://mail.gnome.org/archives/libsoup-list/2011-November/msg00000.html
https://bugzilla.gnome.org/show_bug.cgi?id=729737
libsoup/soup-connection.c | 7 +++----
libsoup/soup-socket.c | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 92571fa..48df8e3 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -327,8 +327,6 @@ socket_connect_finished (GTask *task, SoupSocket *sock, GError *error)
SoupConnection *conn = g_task_get_source_object (task);
SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);
- soup_socket_properties_pop_async_context (priv->socket_props);
-
g_signal_handlers_disconnect_by_func (sock, G_CALLBACK (re_emit_socket_event), conn);
if (!error) {
@@ -433,6 +431,7 @@ soup_connection_connect_async (SoupConnection *conn,
soup_socket_connect_async_internal (priv->socket, cancellable,
socket_connect_complete, task);
+ soup_socket_properties_pop_async_context (priv->socket_props);
}
gboolean
@@ -554,8 +553,6 @@ start_ssl_completed (GObject *object, GAsyncResult *result, gpointer user_data)
SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);
GError *error = NULL;
- soup_socket_properties_pop_async_context (priv->socket_props);
-
if (soup_socket_handshake_finish (priv->socket, result, &error)) {
soup_connection_event (conn, G_SOCKET_CLIENT_TLS_HANDSHAKED, NULL);
soup_connection_event (conn, G_SOCKET_CLIENT_COMPLETE, NULL);
@@ -584,6 +581,8 @@ soup_connection_start_ssl_async (SoupConnection *conn,
soup_socket_handshake_async (priv->socket, priv->remote_uri->host,
cancellable, start_ssl_completed, task);
+
+ soup_socket_properties_pop_async_context (priv->socket_props);
}
gboolean
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
index 157a4cf..9d935d3 100644
--- a/libsoup/soup-socket.c
+++ b/libsoup/soup-socket.c
@@ -955,14 +955,10 @@ legacy_connect_async_cb (GObject *object,
gpointer user_data)
{
SoupSocket *sock = SOUP_SOCKET (object);
- SoupSocketPrivate *priv = SOUP_SOCKET_GET_PRIVATE (sock);
SoupSocketAsyncConnectData *sacd = user_data;
GError *error = NULL;
guint status;
- if (priv->async_context && !priv->use_thread_context)
- g_main_context_pop_thread_default (priv->async_context);
-
if (soup_socket_connect_finish_internal (sock, result, &error))
status = SOUP_STATUS_OK;
else
@@ -1012,6 +1008,9 @@ soup_socket_connect_async (SoupSocket *sock, GCancellable *cancellable,
soup_socket_connect_async_internal (sock, cancellable,
legacy_connect_async_cb,
sacd);
+
+ if (priv->async_context && !priv->use_thread_context)
+ g_main_context_pop_thread_default (priv->async_context);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]