session: Clean up handling of run queue source
@walters
Submitted by Colin Walters Assigned to libsoup-maint@gnome.bugs
Link to original bug (#768567)
Description
We're seeing an occasional crash in ostree: https://github.com/ostreedev/ostree/issues/373
This patch appears to fix it. I can't say that I conclusively know the exact bug, but there are a few things this patch cleans up.
First, if self->disposed
is true, the source will be destroyed, but
remained on the list. Fix that by moving down the if (self->disposed)
conditional.
Another thing I observed then is that actually, this list can have
at most one element in the current codebase. So then we can just
store a GSource*
reference in priv
.
Then, we no longer need to search through all sources on the main
context for our priv
pointer, we can just reference the pointer.
This is a very common pattern.
Now, we don't even need to call
g_main_context_find_source_by_user_data()
or
g_main_current_source()
.