On 26 November 2015 at 17:01, Michael S. Tsirkin <m...@redhat.com> wrote: > Last note: > https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#mainloop-memory-management > suggests two ways to manage memory for sources. > We seem to do neither, opting for a different approach.
We seem to pretty much be using what that doc calls the "preferred approach": we record the tag we get back from g_source_attach (this happens in io_add_watch_poll()). Then on object destruction we call remove_fd_in_watch() with that tag, which calls io_remove_watch_poll(), which does a g_source_destroy(). And it looks like g_source_destroy() is the "works on any GMainContext" version of g_source_remove(). So I guess the question is: when this bug happens, have we called g_source_destroy() before we got the callback from glib, or is the problem that we didn't actually call g_source_destroy() on everything we should have as part of the destructor? It's getting a bit late here now but I can have a look at this tomorrow if nobody else gets there first. thanks -- PMM