VirtualBox

Changeset 28316 in vbox for trunk/src/VBox/Main/glue


Ignore:
Timestamp:
Apr 14, 2010 6:01:39 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60075
Message:

com/string.h,Main: Removed Utf8Str::asOutParam() as it mixed allocators - COM/XPCOM allocates the returned param, while RTMemFree is used to free it -> bang.

Location:
trunk/src/VBox/Main/glue
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/glue/ErrorInfo.cpp

    r26603 r28316  
    8888    }
    8989
    90 #else // !defined (VBOX_WITH_XPCOM)
    91 
    92     nsCOMPtr <nsIExceptionService> es;
    93     es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
     90#else // defined (VBOX_WITH_XPCOM)
     91
     92    nsCOMPtr<nsIExceptionService> es;
     93    es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
    9494    if (NS_SUCCEEDED(rc))
    9595    {
    96         nsCOMPtr <nsIExceptionManager> em;
    97         rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
     96        nsCOMPtr<nsIExceptionManager> em;
     97        rc = es->GetCurrentExceptionManager(getter_AddRefs (em));
    9898        if (NS_SUCCEEDED(rc))
    9999        {
    100100            ComPtr<nsIException> ex;
    101             rc = em->GetCurrentException (ex.asOutParam());
     101            rc = em->GetCurrentException(ex.asOutParam());
    102102            if (NS_SUCCEEDED(rc) && ex)
    103103            {
     
    114114                    bool gotSomething = false;
    115115
    116                     rc = ex->GetResult (&mResultCode);
     116                    rc = ex->GetResult(&mResultCode);
    117117                    gotSomething |= NS_SUCCEEDED(rc);
    118118
    119                     Utf8Str message;
    120                     rc = ex->GetMessage(message.asOutParam());
    121                     message.jolt();
     119                    char *pszMsg;
     120                    rc = ex->GetMessage(&pszMsg);
    122121                    gotSomething |= NS_SUCCEEDED(rc);
    123122                    if (NS_SUCCEEDED(rc))
    124                         mText = message;
     123                    {
     124                        mText = Bstr(pszMsg);
     125                        nsMemory::Free(mText);
     126                    }
    125127
    126128                    if (gotSomething)
     
    140142    AssertComRC (rc);
    141143
    142 #endif // !defined (VBOX_WITH_XPCOM)
     144#endif // defined (VBOX_WITH_XPCOM)
    143145}
    144146
  • trunk/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp

    r26753 r28316  
    107107}
    108108
    109 #if !defined (VBOX_WITH_XPCOM)
     109#if !defined(VBOX_WITH_XPCOM)
    110110
    111111/**
     
    166166}
    167167
    168 #else // !defined (VBOX_WITH_XPCOM)
     168#else // !defined(VBOX_WITH_XPCOM)
    169169
    170170/**
     
    172172 *  object.
    173173 */
    174 HRESULT VirtualBoxErrorInfo::init (nsIException *aInfo)
     174HRESULT VirtualBoxErrorInfo::init(nsIException *aInfo)
    175175{
    176176    AssertReturn(aInfo, E_FAIL);
     
    182182     * corresponding fields will simply remain null in this case). */
    183183
    184     rc = aInfo->GetResult (&mResultCode);
    185     AssertComRC (rc);
    186     Utf8Str message;
    187     rc = aInfo->GetMessage(message.asOutParam());
    188     message.jolt();
    189     AssertComRC (rc);
    190     mText = message;
     184    rc = aInfo->GetResult(&mResultCode);
     185    AssertComRC(rc);
     186
     187    char *pszMsg;
     188    rc = aInfo->GetMessage(&pszMsg);
     189    AssertComRC(rc);
     190    if (NS_SUCCEEDED(rc))
     191    {
     192        mText = Bstr(pszMsg);
     193        nsMemory::Free(pszMsg);
     194    }
     195    else
     196        mText.setNull();
    191197
    192198    return S_OK;
     
    273279                               nsIException, IVirtualBoxErrorInfo)
    274280
    275 #endif /* !defined (VBOX_WITH_XPCOM) */
     281#endif /* !defined(VBOX_WITH_XPCOM) */
    276282
    277283////////////////////////////////////////////////////////////////////////////////
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