VirtualBox

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/VirtualBoxErrorInfoImpl.cpp

    r25149 r28316  
    8282}
    8383
    84 #if !defined (VBOX_WITH_XPCOM)
     84#if !defined(VBOX_WITH_XPCOM)
    8585
    8686/**
     
    141141}
    142142
    143 #else // !defined (VBOX_WITH_XPCOM)
     143#else // defined(VBOX_WITH_XPCOM)
    144144
    145145/**
     
    147147 *  object.
    148148 */
    149 HRESULT VirtualBoxErrorInfo::init (nsIException *aInfo)
     149HRESULT VirtualBoxErrorInfo::init(nsIException *aInfo)
    150150{
    151151    AssertReturn(aInfo, E_FAIL);
     
    157157     * corresponding fields will simply remain null in this case). */
    158158
    159     rc = aInfo->GetResult (&mResultCode);
    160     AssertComRC (rc);
    161     Utf8Str message;
    162     rc = aInfo->GetMessage(message.asOutParam());
    163     message.jolt();
    164     AssertComRC (rc);
    165     mText = message;
     159    rc = aInfo->GetResult(&mResultCode);
     160    AssertComRC(rc);
     161
     162    char *pszMsg;             /* No Utf8Str.asOutParam, different allocator! */
     163    rc = aInfo->GetMessage(&pszMsg);
     164    AssertComRC(rc);
     165    if (NS_SUCCEEDED(rc))
     166    {
     167        mText = Bstr(pszMsg);
     168        nsMemory::Free(pszMsg);
     169    }
     170    else
     171        mText.setNull();
    166172
    167173    return S_OK;
     
    247253                               nsIException, IVirtualBoxErrorInfo)
    248254
    249 #endif // !defined (VBOX_WITH_XPCOM)
     255#endif // defined(VBOX_WITH_XPCOM)
    250256/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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