From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a20Vq-0002Bh-N7 for qemu-devel@nongnu.org; Thu, 26 Nov 2015 12:39:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a20Vp-0004Zo-MF for qemu-devel@nongnu.org; Thu, 26 Nov 2015 12:39:18 -0500 Received: from mail-vk0-x236.google.com ([2607:f8b0:400c:c05::236]:34327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a20Vp-0004Zk-Ew for qemu-devel@nongnu.org; Thu, 26 Nov 2015 12:39:17 -0500 Received: by vkbs1 with SMTP id s1so56857273vkb.1 for ; Thu, 26 Nov 2015 09:39:17 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20151126170122.GA25998@redhat.com> References: <20151126170122.GA25998@redhat.com> From: Peter Maydell Date: Thu, 26 Nov 2015 17:38:57 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] qemu-char issues (was Re: [PULL 00/15] vhost, pc: fixes for List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= , QEMU Developers , Paolo Bonzini On 26 November 2015 at 17:01, Michael S. Tsirkin 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