From cdf821eb2abbb70b0eba3833e3f0cf128a04e97d Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 13 Sep 2017 21:16:24 -0400 Subject: [PATCH] Debugger: Fix #13710. TeamWindow: - When changing the active function, we would also attempt to select a stack frame matching that function. However, in the case where the active function was set via changing stack frames, this logic would break if the function was recursive, and would cause the topmost frame to be selected instead of one at the desired recursion depth. --- .../debugger/user_interface/gui/team_window/TeamWindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index ba5480d157..94099d1270 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2010-2016, Rene Gollent, rene@gollent.com. + * Copyright 2010-2017, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -1428,6 +1428,16 @@ TeamWindow::_SetActiveFunction(FunctionInstance* functionInstance) locker.Lock(); + // if we already have an active stack frame at the requested + // function, we're done. This will be the case if e.g. the function + // is being set as a result of a call to _SetActiveStackFrame(), and + // would otherwise lead to issues in recursive cases where the wrong + // frame might mistakenly be selected. + if (fActiveStackFrame != NULL + && fActiveStackFrame->Function() == fActiveFunction) { + return; + } + // look if our current stack trace has a frame matching the selected // function. If so, set it to match. StackFrame* matchingFrame = NULL; -- 2.11.4.GIT