[vbox-dev] Qt-GUI: Question about X11 native event filter on focus out - possible mouse unrelease race

Sascha Münzberg sascha at 2log.io
Thu Sep 23 10:27:35 GMT 2021


Hi,

possibly since VBox 6 I'm affected by a bug which blocks mouse click
events on host/guest after a certain sequence of focus in and focus out
events. I created a bug report here:
https://www.virtualbox.org/ticket/20355. Here is a screen cast of the
bug as GIF: https://s3.gifyu.com/images/vbox-bug.gif.

I tried to trace the bug and reached the following focus out event
handler in the file
src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp:

void UIMachineView::focusOutEvent(QFocusEvent *pEvent)
{
    /* If native event filter exists: */
    if (m_pNativeEventFilter)
    {
        /* Uninstall/destroy existing native event filter: */
        qApp->removeNativeEventFilter(m_pNativeEventFilter);
        delete m_pNativeEventFilter;
        m_pNativeEventFilter = 0;
    }
    /* Call to base-class: */
    QAbstractScrollArea::focusOutEvent(pEvent);
}

I figured out, that the bug does not occur if that native event filter
is not uninstalled during a focus out event. Could someone explain why
the filter is actually uninstalled during a focus out event?

I assume there is a possible race condition with the (re-)installation
of the filter in a subsequent focusInEvent.

Kind Regards,
Sascha



More information about the vbox-dev mailing list