Skip to content

Commit 83dfed7

Browse files
committed
TestEngine: fixed issue with capture tool accessing erroneous stack data.
1 parent 4d6bce6 commit 83dfed7

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

docs/CHANGELOG.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ CHANGELOG
55
Those changes are not all listed here.
66
** For a while this is going to ONLY INCLUDE BREAKING CHANGES.
77

8+
2025/04/24:
9+
- TestEngine: fixed crash/issue in capture tool.
10+
811
2025/03/17:
912
- TestEngine: *BREAKING* reworked ImGuiTestEngine_GetResult() as ImGuiTestEngine_GetResultSummary()
1013
outputting a structure where we can add more fields.

imgui_test_engine/imgui_capture_tool.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ void ImGuiCaptureContext::PreRender()
206206
if (IsCapturing())
207207
{
208208
const ImGuiCaptureArgs* args = _CaptureArgs;
209+
IM_ASSERT(args != NULL);
209210
g.IO.MouseDrawCursor = !(args->InFlags & ImGuiCaptureFlags_HideMouseCursor);
210211
}
211212
}
@@ -618,6 +619,7 @@ void ImGuiCaptureContext::EndVideoCapture()
618619
IM_ASSERT(_VideoRecording == true);
619620

620621
_VideoRecording = false;
622+
_CaptureArgs = nullptr;
621623
}
622624

623625
bool ImGuiCaptureContext::IsCapturingVideo()

imgui_test_engine/imgui_te_engine.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,7 @@ void ImGuiTestEngine_RunTest(ImGuiTestEngine* engine, ImGuiTestContext* parent_c
16391639
test_output->EndTime = test_output->StartTime;
16401640
ctx->Test = nullptr;
16411641
ctx->TestOutput = nullptr;
1642+
ctx->CaptureArgs = nullptr;
16421643
return;
16431644
}
16441645

@@ -1921,6 +1922,11 @@ void ImGuiTestEngine_RunTest(ImGuiTestEngine* engine, ImGuiTestContext* parent_c
19211922
}
19221923
}
19231924

1925+
// 'ctx' at this point is either a local variable or shared with parent.
1926+
//ctx->Test = nullptr;
1927+
//ctx->TestOutput = nullptr;
1928+
//ctx->CaptureArgs = nullptr;
1929+
19241930
IM_ASSERT(engine->TestContext == ctx);
19251931
engine->TestContext = parent_ctx;
19261932
}

0 commit comments

Comments
 (0)