1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-08 23:44:19 +00:00

Textures: prevent assert/crash of having a destroyed texture recreated without the pixels data available (#9150, #8811)

Amend 8c22b8aef
This commit is contained in:
Sammy Fatnassi 2026-01-03 14:26:29 -05:00 committed by GitHub
parent 960921f03a
commit 25158fe33b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3509,7 +3509,7 @@ struct ImTextureData
// - Call SetTexID() and SetStatus() after honoring texture requests. Never modify TexID and Status directly!
// - 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.
void SetTexID(ImTextureID tex_id) { TexID = tex_id; }
void SetStatus(ImTextureStatus status) { Status = status; if (status == ImTextureStatus_Destroyed && !WantDestroyNextFrame) Status = ImTextureStatus_WantCreate; }
void SetStatus(ImTextureStatus status) { Status = status; if (status == ImTextureStatus_Destroyed && !WantDestroyNextFrame && Pixels != nullptr) Status = ImTextureStatus_WantCreate; }
};
//-----------------------------------------------------------------------------