pull: Go back to using one main context
xdg-app was hanging for me with v2015.8, but worked with v2015.7. I narrowed things down to the GMainLoop/context commit, in which we started pushing a temporary main context for synchronous requests internally. That's never really going to work with libsoup - there needs to be a single main context which works on the socket. Furthermore, clients couldn't get progress messages that way. For *other* internal uses where we added APIs that talk to the remote repo, we cleanly push a temporary main context. (Note that I kind of snuck in a change here around the GError handling in pulls that isn't strictly related but came up in testing)
This commit is contained in:
1 parent
ef56321354
commit
84fe2ffb2b
4 files changed
+32
-10
No files matched your search
@@ -731,6 +731,10 @@ 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,
|
||||
@@ -754,8 +758,7 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
|
||||
if (g_cancellable_set_error_if_cancelled (cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
mainctx = g_main_context_new ();
|
||||
g_main_context_push_thread_default (mainctx);
|
||||
mainctx = g_main_context_ref_thread_default ();
|
||||
|
||||
data.done = FALSE;
|
||||
data.error = error;
|
||||
@@ -800,8 +803,6 @@ _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