VirtualBox

Changeset 66952 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 18, 2017 3:05:51 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115493
Message:

FE/Qt: Runtime UI: Mini-toolbar: Workaround for a crash happening in case when QDesktopWidget::screenNumber() returns -1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp

    r66951 r66952  
    688688
    689689    /* Get corresponding host-screen: */
    690     const int iHostScreen = gpDesktop->screenNumber(m_pParent);
    691     Q_UNUSED(iHostScreen);
    692     /* And corresponding working area: */
     690    const int iHostScreenCount = gpDesktop->screenCount();
     691    int iHostScreen = gpDesktop->screenNumber(m_pParent);
     692    // WORKAROUND:
     693    // When switching host-screen count, especially in complex cases where RDP client is "replacing" host-screen(s) with own virtual-screen(s),
     694    // Qt could behave quite arbitrary and laggy, and due to racing there could be a situation when QDesktopWidget::screenNumber() returns -1
     695    // as a host-screen number where the parent window is currently located. We should handle this situation anyway, so let's assume the parent
     696    // window is located on primary (0) host-screen if it's present or ignore this request at all.
     697    if (iHostScreen < 0 || iHostScreen >= iHostScreenCount)
     698    {
     699        if (iHostScreenCount > 0)
     700        {
     701            LogRel(("GUI:  Mini-toolbar parent window #%d is located on invalid host-screen #%d. Fallback to primary.\n", m_iWindowIndex, iHostScreen));
     702            iHostScreen = 0;
     703        }
     704        else
     705        {
     706            LogRel(("GUI:  Mini-toolbar parent window #%d is located on invalid host-screen #%d. Ignore request.\n", m_iWindowIndex, iHostScreen));
     707            return;
     708        }
     709    }
     710
     711    /* Get corresponding working area: */
    693712    QRect workingArea;
    694713    switch (m_geometryType)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette