• J
    Fix monitor ref counting when adding event handle · d84bb6d6
    Jiri Denemark 提交于
    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.
    d84bb6d6
qemu_monitor.c 40.8 KB