VirtualBox

Changeset 78759 in vbox for trunk/include/VBox


Ignore:
Timestamp:
May 26, 2019 3:13:07 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130846
Message:

VBox/com/ptr.h,VBox/com/microatl.h: Catch all bad_alloc exceptions in createObject and CreateInstance and turn them into E_OUTOFMEMORY return codes. This greatly simplifies exception analysis in code using these two methods. [build fix]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/ptr.h

    r78757 r78759  
    514514#else /* VBOX_WITH_XPCOM */
    515515        ATL::CComObject<T> *obj;
     516# ifndef RT_EXCEPTIONS_ENABLED
     517        obj = new ATL::CComObject<T>();
     518# else
    516519        try
    517520        {
     
    522525            obj = NULL;
    523526        }
     527# endif
    524528        if (obj)
    525529        {
     530# ifndef RT_EXCEPTIONS_ENABLED
    526531            try
    527532            {
     
    530535            catch (std::bad_alloc &)
    531536            {
     537                hrc = E_OUTOFMEMORY;
     538            }
     539# else
     540            hrc = obj->FinalConstruct();
     541# endif
     542            if (FAILED(hrc))
     543            {
    532544                delete obj;
    533545                obj = NULL;
    534                 hrc = E_OUTOFMEMORY;
    535546            }
    536547        }
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