Skip to content

Commit

Permalink
fix some samples releasing a null surface texture (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
radgeRayden authored Nov 10, 2023
1 parent cf02ef3 commit a004228
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/texture_arrays/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,9 @@ int main(int argc, char *argv[]) {
case WGPUSurfaceGetCurrentTextureStatus_Outdated:
case WGPUSurfaceGetCurrentTextureStatus_Lost: {
// Skip this frame, and re-configure surface.
wgpuTextureRelease(surface_texture.texture);
if (surface_texture.texture != NULL) {
wgpuTextureRelease(surface_texture.texture);
}
int width, height;
glfwGetWindowSize(window, &width, &height);
if (width != 0 && height != 0) {
Expand Down
4 changes: 3 additions & 1 deletion examples/triangle/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ int main(int argc, char *argv[]) {
case WGPUSurfaceGetCurrentTextureStatus_Outdated:
case WGPUSurfaceGetCurrentTextureStatus_Lost: {
// Skip this frame, and re-configure surface.
wgpuTextureRelease(surface_texture.texture);
if (surface_texture.texture != NULL) {
wgpuTextureRelease(surface_texture.texture);
}
int width, height;
glfwGetWindowSize(window, &width, &height);
if (width != 0 && height != 0) {
Expand Down

0 comments on commit a004228

Please sign in to comment.