Mouse click stops working on host/guest due to window focusOutEvent problem in Qt GUI
Posted: 7. May 2021, 17:37
Hi,
for more than two years now (so probably since VB version 6.0 or so) from time to time I am affected by a very anoying bug. Then mouse clicks stops working on the host and the 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.
I am sure it is not a drag and drop problem like in https://www.virtualbox.org/ticket/14743
There will be no entry in the logs, when the bug occurs. 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:
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 immediatly 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
When the bug occurs *xprop* on the hosts exits with the error "xprop: error: Can't grab the mouse" - on the guest it just hangs as no click is registered. Also the bug only occurs with the Qt front end of VirtualBox - with the SDL front end I couldn't reproduce the error.
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.
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.
Can anyone help me to debug this further?
Thanks a lot!
for more than two years now (so probably since VB version 6.0 or so) from time to time I am affected by a very anoying bug. Then mouse clicks stops working on the host and the 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.
I am sure it is not a drag and drop problem like in https://www.virtualbox.org/ticket/14743
There will be no entry in the logs, when the bug occurs. 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:
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 immediatly 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
When the bug occurs *xprop* on the hosts exits with the error "xprop: error: Can't grab the mouse" - on the guest it just hangs as no click is registered. Also the bug only occurs with the Qt front end of VirtualBox - with the SDL front end I couldn't reproduce the error.
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.
Code: Select all
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);
}
Can anyone help me to debug this further?
Thanks a lot!