I've seen some weird behaviors of the GTask returning immediately when it was supposed to return in idle, in spice-gtk code. What I got from a brief talk with Dan Winship is that "a GTask will return immediately only if: (a) it is in a thread which is running the GMainContext that the task was started in, and (b) that GMainContext has run at least one iteration since the thread started (...) So if you have tasks that are returning immediately when they shouldn't be, figure out how it is that those conditions are coming to be true when you don't expect them to be)". And that "If you are doing things like messing with the stack or calling setcontext(), then it's possible that could mess things up. I don't know." Let's investigate how to fix the coroutines on our side and, later on, open a bug on GLib as well if that's the case.
No conflict for me, the task GMainContext is the same (there is no thread etc). It makes sense that there has been further main loop iteration before the task returns. spicevmc want to return in idle, so the caller resumes in "main" coroutine context. I don't know what happens if you do the task return from the coroutine. Most likely, this ends in laster coroutine yields errors if the resume function do not deal well with coroutine contexts.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/spice/spice-gtk/issues/4.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.