pull: Push a temporary main context for sync requests
Given the previous commit, which isolates SoupSession in a separate thread, it should be safe to start pushing a temporary main context for synchronous requests again. This partially reverts84fe2ff, which partially reverted9f3d586. Related to https://bugzilla.gnome.org/show_bug.cgi?id=753336
This commit is contained in:
1 parent
54066420cf
commit
f0b143ca8a
2 files changed
+8
-11
No files matched your search
@@ -1083,10 +1083,6 @@ fetch_uri_sync_on_complete (GObject *object,
|
||||
data->done = TRUE;
|
||||
}
|
||||
|
||||
/* Synchronously request a URI - will iterate the thread-default main
|
||||
* context for historical reasons. If you don't want that, push a
|
||||
* temporary one.
|
||||
*/
|
||||
gboolean
|
||||
_ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
|
||||
SoupURI *uri,
|
||||
@@ -1110,7 +1106,8 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
|
||||
if (g_cancellable_set_error_if_cancelled (cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
mainctx = g_main_context_ref_thread_default ();
|
||||
mainctx = g_main_context_new ();
|
||||
g_main_context_push_thread_default (mainctx);
|
||||
|
||||
data.done = FALSE;
|
||||
data.error = error;
|
||||
@@ -1155,6 +1152,8 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
|
||||
ret = TRUE;
|
||||
*out_contents = g_memory_output_stream_steal_as_bytes (buf);
|
||||
out:
|
||||
if (mainctx)
|
||||
g_main_context_pop_thread_default (mainctx);
|
||||
g_clear_object (&(data.result_stream));
|
||||
return ret;
|
||||
}
|
||||
Reference in new issue
Block a user