VirtualBox

Changeset 56022 in vbox for trunk/src


Ignore:
Timestamp:
May 22, 2015 9:28:22 AM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Selector UI: Details-pane: VM preview: Do not assert if guest-screen size is null, deal with it instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp

    r55854 r56022  
    213213                        break;
    214214
    215                     /* Calculate aspect-ratio: */
    216                     double dAspectRatio = (double)uGuestWidth / uGuestHeight;
    217                     /* Look for the best aspect-ratio preset: */
    218                     preset = bestAspectRatioPreset(dAspectRatio, m_ratios);
     215                    if (uGuestWidth > 0 && uGuestHeight > 0)
     216                    {
     217                        /* Calculate aspect-ratio: */
     218                        const double dAspectRatio = (double)uGuestWidth / uGuestHeight;
     219                        /* Look for the best aspect-ratio preset: */
     220                        preset = bestAspectRatioPreset(dAspectRatio, m_ratios);
     221                    }
    219222
    220223                    /* Create image based on shallow copy or screenshot data,
     
    246249                        break;
    247250
    248                     /* Calculate aspect-ratio: */
    249                     LONG iOriginX, iOriginY;
    250                     ULONG uGuestWidth, uGuestHeight, uBpp;
     251                    /* Acquire guest-screen attributes: */
     252                    LONG iOriginX = 0, iOriginY = 0;
     253                    ULONG uGuestWidth = 0, uGuestHeight = 0, uBpp = 0;
    251254                    KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
    252255                    display.GetScreenResolution(0, uGuestWidth, uGuestHeight, uBpp, iOriginX, iOriginY, monitorStatus);
    253                     if (uGuestWidth == 0 || uGuestHeight == 0)
     256                    if (uGuestWidth > 0 && uGuestHeight > 0)
    254257                    {
    255                         AssertMsgFailed(("Acquired guest screen resolution is %dx%d\n",
    256                                          uGuestWidth, uGuestHeight));
    257                         break;
     258                        /* Calculate aspect-ratio: */
     259                        const double dAspectRatio = (double)uGuestWidth / uGuestHeight;
     260                        /* Look for the best aspect-ratio preset: */
     261                        preset = bestAspectRatioPreset(dAspectRatio, m_ratios);
    258262                    }
    259 
    260                     double dAspectRatio = (double)uGuestWidth / uGuestHeight;
    261                     /* Look for the best aspect-ratio preset preset: */
    262                     preset = bestAspectRatioPreset(dAspectRatio, m_ratios);
    263263
    264264                    /* Calculate size corresponding to aspect-ratio: */
     
    524524    /* Make sure host-size and guest-size are valid: */
    525525    AssertReturn(!hostSize.isNull(), QSize());
    526     AssertReturn(!guestSize.isNull(), hostSize);
     526    if (guestSize.isNull())
     527        return hostSize;
    527528
    528529    /* Calculate host/guest aspect-ratio: */
Note: See TracChangeset for help on using the changeset viewer.

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