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
@@ -589,6 +589,11 @@ typedef struct
|
||||
GMainLoop *loop;
|
||||
} FetchMetalinkSyncData;
|
||||
|
||||
/*
|
||||
* Note that for legacy reasons we iterate the caller's main context.
|
||||
* If you don't want that (and you probably don't) push a temporary
|
||||
* one.
|
||||
*/
|
||||
gboolean
|
||||
_ostree_metalink_request_sync (OstreeMetalink *self,
|
||||
SoupURI **out_target_uri,
|
||||
@@ -607,8 +612,7 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
|
||||
if (fetching_sync_uri != NULL)
|
||||
*fetching_sync_uri = _ostree_metalink_get_uri (self);
|
||||
|
||||
mainctx = g_main_context_new ();
|
||||
g_main_context_push_thread_default (mainctx);
|
||||
mainctx = g_main_context_ref_thread_default ();
|
||||
|
||||
request.metalink = g_object_ref (self);
|
||||
request.urls = g_ptr_array_new_with_free_func ((GDestroyNotify) soup_uri_free);
|
||||
@@ -633,8 +637,6 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
if (mainctx)
|
||||
g_main_context_pop_thread_default (mainctx);
|
||||
g_clear_object (&request.metalink);
|
||||
g_clear_pointer (&request.urls, g_ptr_array_unref);
|
||||
g_clear_pointer (&request.parser, g_markup_parse_context_free);
|
||||
|
||||
Reference in new issue
Block a user