From d61d53d4bb82c7602f894ade5e8745eb6b841523 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Mon, 10 Jul 2017 03:04:36 +0300 Subject: [PATCH] Remove ToRelease copy constructor --- src/debug/debugger/breakpoints.cpp | 6 +++--- src/debug/debugger/main.cpp | 8 ++++---- src/debug/debugger/torelease.h | 1 + src/debug/debugger/varobj.cpp | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/debug/debugger/breakpoints.cpp b/src/debug/debugger/breakpoints.cpp index 8507ad1..84dda0b 100644 --- a/src/debug/debugger/breakpoints.cpp +++ b/src/debug/debugger/breakpoints.cpp @@ -222,7 +222,7 @@ HRESULT CreateBreakpointInProcess(ICorDebugProcess *pProcess, std::string filena ULONG domainsFetched; while (SUCCEEDED(domains->Next(1, &curDomain, &domainsFetched)) && domainsFetched == 1) { - ToRelease pDomain = curDomain; + ToRelease pDomain(curDomain); ToRelease assemblies; IfFailRet(pDomain->EnumerateAssemblies(&assemblies)); @@ -231,7 +231,7 @@ HRESULT CreateBreakpointInProcess(ICorDebugProcess *pProcess, std::string filena ULONG assembliesFetched; while (SUCCEEDED(assemblies->Next(1, &curAssembly, &assembliesFetched)) && assembliesFetched == 1) { - ToRelease pAssembly = curAssembly; + ToRelease pAssembly(curAssembly); ToRelease modules; IfFailRet(pAssembly->EnumerateModules(&modules)); @@ -240,7 +240,7 @@ HRESULT CreateBreakpointInProcess(ICorDebugProcess *pProcess, std::string filena ULONG modulesFetched; while (SUCCEEDED(modules->Next(1, &curModule, &modulesFetched)) && modulesFetched == 1) { - ToRelease pModule = curModule; + ToRelease pModule(curModule); if (SUCCEEDED(ResolveBreakpoint(pModule, filename, linenum, bp))) { std::lock_guard lock(g_breakMutex); diff --git a/src/debug/debugger/main.cpp b/src/debug/debugger/main.cpp index ec54ef8..7aeb845 100644 --- a/src/debug/debugger/main.cpp +++ b/src/debug/debugger/main.cpp @@ -191,7 +191,7 @@ HRESULT PrintThreadsState(ICorDebugController *controller, std::string &output) const char *sep = ""; while (SUCCEEDED(Status = pThreads->Next(1, &handle, &fetched)) && fetched == 1) { - ToRelease pThread = handle; + ToRelease pThread(handle); std::string threadOutput; PrintThread(pThread, threadOutput); @@ -253,7 +253,7 @@ HRESULT DisableAllBreakpointsAndSteppersInAppDomain(ICorDebugAppDomain *pAppDoma ULONG breakpointsFetched; while (SUCCEEDED(breakpoints->Next(1, &curBreakpoint, &breakpointsFetched)) && breakpointsFetched == 1) { - ToRelease pBreakpoint = curBreakpoint; + ToRelease pBreakpoint(curBreakpoint); pBreakpoint->Activate(FALSE); } } @@ -267,7 +267,7 @@ HRESULT DisableAllBreakpointsAndSteppersInAppDomain(ICorDebugAppDomain *pAppDoma ULONG steppersFetched; while (SUCCEEDED(steppers->Next(1, &curStepper, &steppersFetched)) && steppersFetched == 1) { - ToRelease pStepper = curStepper; + ToRelease pStepper(curStepper); pStepper->Deactivate(); } } @@ -286,7 +286,7 @@ HRESULT DisableAllBreakpointsAndSteppers(ICorDebugProcess *pProcess) ULONG domainsFetched; while (SUCCEEDED(domains->Next(1, &curDomain, &domainsFetched)) && domainsFetched == 1) { - ToRelease pDomain = curDomain; + ToRelease pDomain(curDomain); DisableAllBreakpointsAndSteppersInAppDomain(pDomain); } return S_OK; diff --git a/src/debug/debugger/torelease.h b/src/debug/debugger/torelease.h index e48b86a..e180659 100644 --- a/src/debug/debugger/torelease.h +++ b/src/debug/debugger/torelease.h @@ -68,6 +68,7 @@ public: } private: + ToRelease(const ToRelease& that) = delete; T* m_ptr; }; diff --git a/src/debug/debugger/varobj.cpp b/src/debug/debugger/varobj.cpp index b13d0da..8b29c7d 100644 --- a/src/debug/debugger/varobj.cpp +++ b/src/debug/debugger/varobj.cpp @@ -171,7 +171,7 @@ HRESULT PrintValue(ICorDebugValue *pInputValue, ICorDebugILFrame * pILFrame, IMe case ELEMENT_TYPE_FNPTR: { CORDB_ADDRESS addr = 0; - ToRelease pReferenceValue = NULL; + ToRelease pReferenceValue; if(SUCCEEDED(pValue->QueryInterface(IID_ICorDebugReferenceValue, (LPVOID*) &pReferenceValue))) pReferenceValue->GetValue(&addr); ss << ""; -- 2.7.4