Skip to content
  • Paolo Bonzini's avatar
    qemu-char: do not operate on sources from finalize callbacks · 2b316774
    Paolo Bonzini authored
    
    
    Due to a glib bug, the finalize callback is called with the GMainContext
    lock held.  Thus, any operation on the context from the callback will
    cause recursive locking and a deadlock.  This happens, for example,
    when a client disconnects from a socket chardev.
    
    The fix for this is somewhat ugly, because we need to forego polymorphism
    and implement our own function to destroy IOWatchPoll sources.  The
    right thing to do here would be child sources, but we support older
    glib versions that do not have them.  Not coincidentially, glib developers
    found and fixed the deadlock as part of implementing child sources.
    
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Tested-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
    Message-id: 1366385529-10329-5-git-send-email-pbonzini@redhat.com
    Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
    2b316774