- Timestamp:
- May 8, 2012 5:59:43 PM (13 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r40767 r41214 266 266 static HRESULT setErrorStatic(HRESULT aResultCode, const char *pcsz, ...); 267 267 HRESULT setInvalidMachineStateError(); 268 269 static HRESULT handleUnexpectedExceptions(RT_SRC_POS_DECL);270 268 271 269 static const char *convertControllerTypeToDev(StorageControllerType_T enmCtrlType); -
trunk/src/VBox/Main/include/ParallelPortImpl.h
r35638 r41214 6 6 7 7 /* 8 * Copyright (C) 2006-20 07Oracle Corporation8 * Copyright (C) 2006-2012 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 85 85 }; 86 86 87 #endif // ____H_ FLOPPYDRIVEIMPL87 #endif // ____H_PARALLELPORTIMPL 88 88 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/include/SerialPortImpl.h
r35638 r41214 7 7 8 8 /* 9 * Copyright (C) 2006-20 07Oracle Corporation9 * Copyright (C) 2006-2012 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 93 93 }; 94 94 95 #endif // ____H_ FLOPPYDRIVEIMPL95 #endif // ____H_SERIALPORTIMPL 96 96 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r41187 r41214 758 758 WriteLockHandle *stateLockHandle() { return &mStateLock; } 759 759 760 static HRESULT handleUnexpectedExceptions(VirtualBoxBase *const aThis, RT_SRC_POS_DECL); 761 760 762 static HRESULT setErrorInternal(HRESULT aResultCode, 761 763 const GUID &aIID, -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r41120 r41214 279 279 static HRESULT ensureFilePathExists(const Utf8Str &strFileName, bool fCreate); 280 280 281 static HRESULT handleUnexpectedExceptions(RT_SRC_POS_DECL);282 283 281 const Utf8Str& settingsFilePath(); 284 282 -
trunk/src/VBox/Main/src-all/VirtualBoxBase.cpp
r41184 r41214 20 20 #include <iprt/semaphore.h> 21 21 #include <iprt/asm.h> 22 #include <iprt/cpp/exception.h> 23 24 #include <typeinfo> 22 25 23 26 #if !defined (VBOX_WITH_XPCOM) … … 292 295 293 296 AssertMsgFailed (("mState = %d!", mState)); 297 } 298 299 /** 300 * Handles unexpected exceptions by turning them into COM errors in release 301 * builds or by hitting a breakpoint in the release builds. 302 * 303 * Usage pattern: 304 * @code 305 try 306 { 307 // ... 308 } 309 catch (LaLalA) 310 { 311 // ... 312 } 313 catch (...) 314 { 315 rc = VirtualBox::handleUnexpectedExceptions(this, RT_SRC_POS); 316 } 317 * @endcode 318 * 319 * @param aThis object where the exception happened 320 * @param RT_SRC_POS_DECL "RT_SRC_POS" macro instantiation. 321 * */ 322 /* static */ 323 HRESULT VirtualBoxBase::handleUnexpectedExceptions(VirtualBoxBase *const aThis, RT_SRC_POS_DECL) 324 { 325 try 326 { 327 /* re-throw the current exception */ 328 throw; 329 } 330 catch (const RTCError &err) // includes all XML exceptions 331 { 332 return setErrorInternal(E_FAIL, aThis->getClassIID(), aThis->getComponentName(), 333 Utf8StrFmt(tr("%s.\n%s[%d] (%s)"), 334 err.what(), 335 pszFile, iLine, pszFunction).c_str(), 336 false /* aWarning */, 337 true /* aLogIt */); 338 } 339 catch (const std::exception &err) 340 { 341 return setErrorInternal(E_FAIL, aThis->getClassIID(), aThis->getComponentName(), 342 Utf8StrFmt(tr("Unexpected exception: %s [%s]\n%s[%d] (%s)"), 343 err.what(), typeid(err).name(), 344 pszFile, iLine, pszFunction).c_str(), 345 false /* aWarning */, 346 true /* aLogIt */); 347 } 348 catch (...) 349 { 350 return setErrorInternal(E_FAIL, aThis->getClassIID(), aThis->getComponentName(), 351 Utf8StrFmt(tr("Unknown exception\n%s[%d] (%s)"), 352 pszFile, iLine, pszFunction).c_str(), 353 false /* aWarning */, 354 true /* aLogIt */); 355 } 356 357 /* should not get here */ 358 AssertFailed(); 359 return E_FAIL; 294 360 } 295 361 -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r41089 r41214 117 117 #include <memory> // for auto_ptr 118 118 #include <vector> 119 #include <typeinfo>120 119 121 120 … … 3484 3483 } 3485 3484 3486 3487 /**3488 * @copydoc VirtualBox::handleUnexpectedExceptions3489 */3490 /* static */3491 HRESULT Console::handleUnexpectedExceptions(RT_SRC_POS_DECL)3492 {3493 try3494 {3495 /* re-throw the current exception */3496 throw;3497 }3498 catch (const std::exception &err)3499 {3500 return setErrorStatic(E_FAIL,3501 tr("Unexpected exception: %s [%s]\n%s[%d] (%s)"),3502 err.what(), typeid(err).name(),3503 pszFile, iLine, pszFunction);3504 }3505 catch (...)3506 {3507 return setErrorStatic(E_FAIL,3508 tr("Unknown exception\n%s[%d] (%s)"),3509 pszFile, iLine, pszFunction);3510 }3511 3512 /* should not get here */3513 AssertFailed();3514 return E_FAIL;3515 }3516 3485 3517 3486 /* static */ -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r41066 r41214 90 90 91 91 #include <algorithm> 92 93 #include <typeinfo>94 92 95 93 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) … … 453 451 catch (...) 454 452 { 455 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);453 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 456 454 } 457 455 } … … 708 706 catch (...) 709 707 { 710 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);708 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 711 709 } 712 710 … … 2559 2557 catch (...) 2560 2558 { 2561 return VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);2559 return VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 2562 2560 } 2563 2561 … … 8980 8978 catch (...) 8981 8979 { 8982 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);8980 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 8983 8981 } 8984 8982 … … 9127 9125 catch (...) 9128 9126 { 9129 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);9127 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 9130 9128 } 9131 9129 … … 9535 9533 catch (...) 9536 9534 { 9537 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);9535 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 9538 9536 } 9539 9537 … … 12160 12158 catch (...) 12161 12159 { 12162 return VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);12160 return VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 12163 12161 } 12164 12162 return S_OK; -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r40487 r41214 115 115 void updateSnapshotStorageLists(settings::SnapshotsList &sl, const Bstr &bstrOldId, const Bstr &bstrNewId) const; 116 116 void updateStateFile(settings::SnapshotsList &snl, const Guid &id, const Utf8Str &strFile) const; 117 HRESULT createDifferencingMedium(const ComObjPtr<M edium> &pParent, const Utf8Str &strSnapshotFolder, RTCList<ComObjPtr<Medium> > &newMedia, ComObjPtr<Medium> *ppDiff) const;117 HRESULT createDifferencingMedium(const ComObjPtr<Machine> &pMachine, const ComObjPtr<Medium> &pParent, const Utf8Str &strSnapshotFolder, RTCList<ComObjPtr<Medium> > &newMedia, ComObjPtr<Medium> *ppDiff) const; 118 118 static int copyStateFileProgress(unsigned uPercentage, void *pvUser); 119 119 … … 644 644 } 645 645 646 HRESULT MachineCloneVMPrivate::createDifferencingMedium(const ComObjPtr<M edium> &pParent, const Utf8Str &strSnapshotFolder, RTCList<ComObjPtr<Medium> > &newMedia, ComObjPtr<Medium> *ppDiff) const646 HRESULT MachineCloneVMPrivate::createDifferencingMedium(const ComObjPtr<Machine> &pMachine, const ComObjPtr<Medium> &pParent, const Utf8Str &strSnapshotFolder, RTCList<ComObjPtr<Medium> > &newMedia, ComObjPtr<Medium> *ppDiff) const 647 647 { 648 648 HRESULT rc = S_OK; … … 690 690 catch (...) 691 691 { 692 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);692 rc = VirtualBoxBase::handleUnexpectedExceptions(pMachine, RT_SRC_POS); 693 693 } 694 694 … … 1057 1057 ComObjPtr<Medium> pDiff; 1058 1058 /* create the diff under the snapshot medium */ 1059 rc = d->createDifferencingMedium(pLMedium, strTrgSnapshotFolder, 1059 trgLock.release(); 1060 srcLock.release(); 1061 rc = d->createDifferencingMedium(p, pLMedium, strTrgSnapshotFolder, 1060 1062 newMedia, &pDiff); 1063 srcLock.acquire(); 1064 trgLock.acquire(); 1061 1065 if (FAILED(rc)) throw rc; 1062 1066 map.insert(TStrMediumPair(Utf8Str(bstrSrcId), pDiff)); … … 1233 1237 { 1234 1238 ComObjPtr<Medium> pDiff; 1235 rc = d->createDifferencingMedium(pNewParent, strTrgSnapshotFolder, 1239 trgLock.release(); 1240 srcLock.release(); 1241 rc = d->createDifferencingMedium(p, pNewParent, strTrgSnapshotFolder, 1236 1242 newMedia, &pDiff); 1243 srcLock.acquire(); 1244 trgLock.acquire(); 1237 1245 if (FAILED(rc)) throw rc; 1238 1246 /* diff image has to be used... */ … … 1358 1366 catch (...) 1359 1367 { 1360 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);1368 rc = VirtualBoxBase::handleUnexpectedExceptions(p, RT_SRC_POS); 1361 1369 } 1362 1370 -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r41120 r41214 45 45 #include <vector> 46 46 #include <memory> // for auto_ptr 47 48 #include <typeinfo>49 47 50 48 #include "VirtualBoxImpl.h" … … 487 485 catch (...) 488 486 { 489 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);487 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 490 488 } 491 489 … … 3448 3446 catch (...) 3449 3447 { 3450 rc = VirtualBox ::handleUnexpectedExceptions(RT_SRC_POS);3448 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 3451 3449 } 3452 3450 … … 3947 3945 3948 3946 return S_OK; 3949 }3950 3951 /**3952 * Handles unexpected exceptions by turning them into COM errors in release3953 * builds or by hitting a breakpoint in the release builds.3954 *3955 * Usage pattern:3956 * @code3957 try3958 {3959 // ...3960 }3961 catch (LaLalA)3962 {3963 // ...3964 }3965 catch (...)3966 {3967 rc = VirtualBox::handleUnexpectedExceptions (RT_SRC_POS);3968 }3969 * @endcode3970 *3971 * @param RT_SRC_POS_DECL "RT_SRC_POS" macro instantiation.3972 */3973 /* static */3974 HRESULT VirtualBox::handleUnexpectedExceptions(RT_SRC_POS_DECL)3975 {3976 try3977 {3978 /* re-throw the current exception */3979 throw;3980 }3981 catch (const RTCError &err) // includes all XML exceptions3982 {3983 return setErrorStatic(E_FAIL,3984 Utf8StrFmt(tr("%s.\n%s[%d] (%s)"),3985 err.what(),3986 pszFile, iLine, pszFunction).c_str());3987 }3988 catch (const std::exception &err)3989 {3990 return setErrorStatic(E_FAIL,3991 Utf8StrFmt(tr("Unexpected exception: %s [%s]\n%s[%d] (%s)"),3992 err.what(), typeid(err).name(),3993 pszFile, iLine, pszFunction).c_str());3994 }3995 catch (...)3996 {3997 return setErrorStatic(E_FAIL,3998 Utf8StrFmt(tr("Unknown exception\n%s[%d] (%s)"),3999 pszFile, iLine, pszFunction).c_str());4000 }4001 4002 /* should not get here */4003 AssertFailed();4004 return E_FAIL;4005 3947 } 4006 3948
Note:
See TracChangeset
for help on using the changeset viewer.