Skip to content

Commit 70a836b

Browse files
Mattiwattimrexodia
authored andcommitted
Move SafeSymCleanup() call to cbExitProcess so it isn't called when the process may have already terminated
debugLoopFunction: set fdProcessInfo->hProcess and fdProcessInfo->hThread to NULL as these shouldn't be used after this point. The actual CloseHandle calls on these two handles are done by kernel32!ContinueDebugEvent immediately after cbExitProcess
1 parent 2f3f287 commit 70a836b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/dbg/debugger.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,8 @@ static void cbExitProcess(EXIT_PROCESS_DEBUG_INFO* ExitProcess)
14571457
_dbg_animatestop(); // Stop animating
14581458
//unload main module
14591459
SafeSymUnloadModule64(fdProcessInfo->hProcess, pCreateProcessBase);
1460+
//cleanup dbghelp
1461+
SafeSymCleanup(fdProcessInfo->hProcess);
14601462
//history
14611463
dbgcleartracestate();
14621464
dbgClearRtuBreakpoints();
@@ -2734,10 +2736,6 @@ static void debugLoopFunction(void* lpParameter, bool attach)
27342736
stopInfo.reserved = 0;
27352737
plugincbcall(CB_STOPDEBUG, &stopInfo);
27362738

2737-
//cleanup dbghelp
2738-
if(fdProcessInfo->hProcess != nullptr)
2739-
SafeSymCleanup(fdProcessInfo->hProcess);
2740-
27412739
//message the user/do final stuff
27422740
RemoveAllBreakPoints(UE_OPTION_REMOVEALL); //remove all breakpoints
27432741
{
@@ -2757,6 +2755,7 @@ static void debugLoopFunction(void* lpParameter, bool attach)
27572755
GuiSetDebugState(stopped);
27582756
GuiUpdateAllViews();
27592757
dputs(QT_TRANSLATE_NOOP("DBG", "Debugging stopped!"));
2758+
fdProcessInfo->hProcess = fdProcessInfo->hThread = nullptr;
27602759
varset("$hp", (duint)0, true);
27612760
varset("$pid", (duint)0, true);
27622761
if(hProcessToken)

0 commit comments

Comments
 (0)