Changeset 47369 in vbox
- Timestamp:
- Jul 24, 2013 12:35:14 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/ptr.h
r47368 r47369 42 42 #else 43 43 #include <nsISupportsUtils.h> 44 44 45 #endif /* !defined (VBOX_WITH_XPCOM) */ 45 46 46 #include <new> /* For bad_alloc. */47 47 #include <VBox/com/defs.h> 48 48 … … 463 463 HRESULT createObject() 464 464 { 465 HRESULT hr; 466 try 465 HRESULT rc; 466 #if !defined (VBOX_WITH_XPCOM) 467 # ifdef VBOX_COM_OUTOFPROC_MODULE 468 CComObjectNoLock<T> *obj = new CComObjectNoLock<T>(); 469 if (obj) 467 470 { 468 #if !defined (VBOX_WITH_XPCOM)469 # ifdef VBOX_COM_OUTOFPROC_MODULE470 CComObjectNoLock<T> *obj = new CComObjectNoLock<T>();471 471 obj->InternalFinalConstructAddRef(); 472 hr= obj->FinalConstruct();472 rc = obj->FinalConstruct(); 473 473 obj->InternalFinalConstructRelease(); 474 # else 475 CComObject<T> *obj = NULL; 476 hr = CComObject<T>::CreateInstance(&obj); 477 # endif 474 } 475 else 476 rc = E_OUTOFMEMORY; 477 # else 478 CComObject<T> *obj = NULL; 479 rc = CComObject<T>::CreateInstance(&obj); 480 # endif 478 481 #else /* !defined (VBOX_WITH_XPCOM) */ 479 CComObject<T> *obj = new CComObject<T>(); 480 hr = obj->FinalConstruct(); 482 CComObject<T> *obj = new CComObject<T>(); 483 if (obj) 484 rc = obj->FinalConstruct(); 485 else 486 rc = E_OUTOFMEMORY; 481 487 #endif /* !defined (VBOX_WITH_XPCOM) */ 482 *this = obj; 483 } 484 catch(std::bad_alloc &) 485 { 486 hr = E_OUTOFMEMORY; 487 } 488 489 return hr; 488 *this = obj; 489 return rc; 490 490 } 491 491 };
Note:
See TracChangeset
for help on using the changeset viewer.