VirtualBox

Opened 3 years ago

Last modified 2 years ago

#20355 assigned defect

Possible race condition bug in UIMachineView::focusOutEvent / focusInEvent blocks mouse click on host/guest (Qt GUI)

Reported by: Cryptkeeper Owned by: gombara
Component: GUI Version: VirtualBox 6.1.22
Keywords: focusOutEvent mouse click interaction Cc:
Guest type: all Host type: Linux

Description

For more than two years now (so probably since VB version 6.0 or so) from time to time I am affected by a bug which stops mouse click interactions on the host and guest as well. I can still move the mouse pointer but clicks are not recognized anymore. The only solution then is to shut down *all* running guest instances. Then the mouse clicks starts working again. There will be no entry in the logs, when the bug occurs.

How to reproduce

It happend very randomly to me but after a while with a screen record I figured out the following steps to reliable reproduce the bug on XFCE:

1) Click on the taskbar to restore VM window from minimized state
2) Press down the mouse button on the taskbar and keep it pressed
3) Release the mouse button and immediately press it again
4) Now no further clicks are registered until VM is shut down

(I agree that this looks like a very special and rare circumstance - however I think that this bug is a race condition and as I often switch between different windows with the taskbar I'm hit by it very often.)

Here is a screencast of the bug as GIF: https://s3.gifyu.com/images/vbox-bug.gif

Possible cause

From the steps I assume that the bug is kind of a race condition on the minimize respectively focus out / focus in event of the window. So I tried to build VirtualBox from source and try to trace the bug. And indeed I figured out, that the bug does not occure if I comment out the following 3 lines 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 tried to dig deeper but I'm kind of stuck. Because I don't know what this native event filter is used for and why it is destroyed on focus out event.

Change History (6)

comment:1 by gombara, 3 years ago

Owner: set to gombara
Status: newassigned

comment:2 by gombara, 3 years ago

Hi What is your host OS and desktop environment? Also could you please try to reproduce the bug when auto keyboard capture is turned off? It is under "File->Preferences" menu item in the Input page.

comment:3 by Cryptkeeper, 2 years ago

Hi, thanks for your response.

I'm running VirtualBox on an Arch Linux host OS with the XFCE desktop environment and the Numix Frost GTK theme. (Yes, it seems that the bug occurs less frequently with the default Adwaita GTK theme - but it occurs also. This suggest even more a timing/race condition issue.)

However, with your request to turn off the auto keyboard capture I was not able to reproduce the bug afterwards. So for now, this may be a good workaround.

in reply to:  3 comment:4 by GnomeUser, 2 years ago

Replying to Cryptkeeper:

So for now, this may be a good workaround.

This workaround has a major drawback. Hotkeys like Alt+F4 do not work inside VM.

comment:5 by shek, 2 years ago

Turning off auto keyboard capture works but then it makes VirtualBox unusable in a different kind of way. Difficult to escape Wayland now a days and this problem seems to be specific to Wayland Linux Hosts with keyboard capture turned on.

comment:6 by shek, 2 years ago

Commented too soon. This happened with even Auto Capture disabled for keyboard.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use