]> xenbits.xensource.com Git - libvirt.git/commit
Fix monitor ref counting when adding event handle
authorJiri Denemark <jdenemar@redhat.com>
Wed, 12 May 2010 09:50:52 +0000 (11:50 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 12 May 2010 14:07:42 +0000 (16:07 +0200)
commitd84bb6d6a3bd2fdd530184cc9743249ebddbee71
treea8e77f02c3b7434a1b86a8e2b5aed38f26e710ca
parent6ef9d9da5e4fcefb7aa84006202b15600480023b
Fix monitor ref counting when adding event handle

When closing a monitor using qemuMonitorClose(), we are aware of
the possibility the monitor is still being used somewhere:

    /* NB: ordinarily one might immediately set mon->watch to -1
     * and mon->fd to -1, but there may be a callback active
     * that is still relying on these fields being valid. So
     * we merely close them, but not clear their values and
     * use this explicit 'closed' flag to track this state */

but since we call virEventAddHandle() on that monitor without increasing
its ref counter, the monitor is still freed which makes possible users
of it quite unhappy. The unhappiness can lead to a hang if qemuMonitorIO
tries to lock mutex which no longer exists.
src/qemu/qemu_monitor.c