GMainContext: unref pending sources on destroy

It is possible (but unlikely) that there will be a non-empty list of
pending dispatches when we remove the last ref from a GMainContext.
Make sure we drop the refs on the sources appropriately.

Add a (now-working) testcase that demonstrates how to trigger the issue.

https://bugzilla.gnome.org/show_bug.cgi?id=139699