diff options
author | Dan Winship <danw@gnome.org> | 2010-11-23 15:50:42 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2010-11-23 15:53:20 -0500 |
commit | 81664255ad6c3dc09a74695bc863b8903f0a15ca (patch) | |
tree | dd9566f6863e10a871e43a03e9d3e203ecb51382 | |
parent | 84fd3e9bfc19dc64f0502701ec633c99d9fd0ff9 (diff) | |
download | libsoup-81664255ad6c3dc09a74695bc863b8903f0a15ca.tar.gz |
SoupSocket: tweak GMainContext handling
GSocketClient may take multiple steps, in which case we need to make
sure that the socket's async_context is the thread-default context
throughout all of them.
This will break horribly if someone tries to send things off to
multiple different contexts from a single thread, but that was never
supposed to have worked, and always had race conditions anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=635101
-rw-r--r-- | libsoup/soup-socket.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c index c9c2b92f..4e658911 100644 --- a/libsoup/soup-socket.c +++ b/libsoup/soup-socket.c @@ -670,10 +670,14 @@ static void async_connected (GObject *client, GAsyncResult *result, gpointer data) { SoupSocketAsyncConnectData *sacd = data; + SoupSocketPrivate *priv = SOUP_SOCKET_GET_PRIVATE (sacd->sock); GError *error = NULL; GSocketConnection *conn; guint status; + if (priv->async_context) + g_main_context_pop_thread_default (priv->async_context); + conn = g_socket_client_connect_finish (G_SOCKET_CLIENT (client), result, &error); status = socket_connected (sacd->sock, conn, error); @@ -734,9 +738,6 @@ soup_socket_connect_async (SoupSocket *sock, GCancellable *cancellable, priv->connect_cancel, async_connected, sacd); g_object_unref (client); - - if (priv->async_context) - g_main_context_pop_thread_default (priv->async_context); } /** |