VirtualBox

Changeset 41595 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Jun 6, 2012 9:58:30 AM (13 years ago)
Author:
vboxsync
Message:

Main/Machine+Display: do not ignore the error code from DisplayMakePNG, create a nice error message out of it to help tracking down the root cause if it fails for no obvious reason

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r41528 r41595  
    60246024    *aHeight = u32Height;
    60256025
     6026    HRESULT rc = S_OK;
    60266027    uint8_t *pu8PNG = NULL;
    60276028    uint32_t cbPNG = 0;
     
    60296030    uint32_t cyPNG = 0;
    60306031
    6031     DisplayMakePNG(pu8Data, u32Width, u32Height, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 0);
    6032 
    6033     com::SafeArray<BYTE> screenData(cbPNG);
    6034     screenData.initFrom(pu8PNG, cbPNG);
    6035     RTMemFree(pu8PNG);
    6036 
    6037     screenData.detachTo(ComSafeArrayOutArg(aData));
     6032    vrc = DisplayMakePNG(pu8Data, u32Width, u32Height, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 0);
     6033
     6034    if (RT_SUCCESS(vrc))
     6035    {
     6036        com::SafeArray<BYTE> screenData(cbPNG);
     6037        screenData.initFrom(pu8PNG, cbPNG);
     6038        if (pu8PNG)
     6039            RTMemFree(pu8PNG);
     6040        screenData.detachTo(ComSafeArrayOutArg(aData));
     6041    }
     6042    else
     6043    {
     6044        if (pu8PNG)
     6045            RTMemFree(pu8PNG);
     6046            return setError(VBOX_E_IPRT_ERROR,
     6047                            tr("Could not convert screenshot to PNG (%Rrc)"),
     6048                            vrc);
     6049    }
    60386050
    60396051    freeSavedDisplayScreenshot(pu8Data);
    60406052
    6041     return S_OK;
     6053    return rc;
    60426054}
    60436055
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