Skip to content

Commit 2cacf17

Browse files
yuvaltassacopybara-github
authored andcommitted
Defer texture destruction in ImguiBridge to prevent use-after-free.
PiperOrigin-RevId: 935327326 Change-Id: I12a148b71abbe50581c7977a1f6dc5e220c40e81
1 parent 9ac0b28 commit 2cacf17

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/experimental/platform/ux/imgui_bridge.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void ImguiBridge::Update() {
203203
} else if (tex->Status == ImTextureStatus_WantUpdates) {
204204
UpdateTexture(tex);
205205
} else if (tex->Status == ImTextureStatus_WantDestroy &&
206-
tex->UnusedFrames > 0) {
206+
tex->UnusedFrames >= 3) {
207207
DestroyTexture(tex);
208208
}
209209
}

0 commit comments

Comments
 (0)