Skip to content

Commit 25158fe

Browse files
authored
Textures: prevent assert/crash of having a destroyed texture recreated without the pixels data available (#9150, #8811)
Amend 8c22b8a
1 parent 960921f commit 25158fe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

imgui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3509,7 +3509,7 @@ struct ImTextureData
35093509
// - Call SetTexID() and SetStatus() after honoring texture requests. Never modify TexID and Status directly!
35103510
// - A backend may decide to destroy a texture that we did not request to destroy, which is fine (e.g. freeing resources), but we immediately set the texture back in _WantCreate mode.
35113511
void SetTexID(ImTextureID tex_id) { TexID = tex_id; }
3512-
void SetStatus(ImTextureStatus status) { Status = status; if (status == ImTextureStatus_Destroyed && !WantDestroyNextFrame) Status = ImTextureStatus_WantCreate; }
3512+
void SetStatus(ImTextureStatus status) { Status = status; if (status == ImTextureStatus_Destroyed && !WantDestroyNextFrame && Pixels != nullptr) Status = ImTextureStatus_WantCreate; }
35133513
};
35143514

35153515
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)