VirtualBox

Opened 3 years ago

Last modified 6 months ago

#20386 assigned defect

Mouse click stops working on host/guest due to window focusOutEvent problem in Qt GUI

Reported by: Seann Owned by: gombara
Component: other Version: VirtualBox 6.1.22
Keywords: lose mouse focus Cc:
Guest type: Windows Host type: Linux

Description

https://forums.virtualbox.org/viewtopic.php?f=7&t=102798

Here's a cut & paste of problem description:

Mouse click stops working on host/guest due to window focusOutEvent problem in Qt GUI

Postby Cryptkeeper » 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.

Code: Select all Expand view

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.

Can anyone help me to debug this further?

Thanks a lot!

Attachments (1)

vbox等4个文件.zip (171.5 KB ) - added by koen 21 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 by gombara, 3 years ago

I cannot reproduce this. What is the host desktop?

comment:2 by gombara, 3 years ago

Owner: set to gombara
Status: newassigned

comment:3 by MarkD89, 22 months ago

I see this also. I'm using Mate desktop.

It's been rare -- weeks or months between it occurring. However it occurred today and a couple of days ago so maybe it's happening more often now.

Edit, fixed forum link:It's referenced in this forum post also https://forums.virtualbox.org/viewtopic.php?f=7&t=106300

Last edited 22 months ago by MarkD89 (previous) (diff)

by koen, 21 months ago

Attachment: vbox等4个文件.zip added

comment:5 by gusnan, 9 months ago

It seems like there's a workaround by turning off "Mini Toolbar" - Machine - Settings -> "User Interface", and there unchecking the checkbox at the bottom. I'm not the one who found it though, see https://forums.virtualbox.org/viewtopic.php?t=87766&start=30.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use