From 34db21cea863d283936c6e7a3a5a97f2f862b80c Mon Sep 17 00:00:00 2001 From: Lucas Murray <22484+lmurray@users.noreply.github.com> Date: Fri, 4 Apr 2025 16:01:41 +1100 Subject: [PATCH] GPU: Don't pass null properties to SDL_CopyProperties() (cherry picked from commit 300013cea75d8d5cbfa784c46f48db4671b9c2ae) --- src/gpu/d3d12/SDL_gpu_d3d12.c | 4 +++- src/gpu/metal/SDL_gpu_metal.m | 4 +++- src/gpu/vulkan/SDL_gpu_vulkan.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gpu/d3d12/SDL_gpu_d3d12.c b/src/gpu/d3d12/SDL_gpu_d3d12.c index be13d8dac5..e003952264 100644 --- a/src/gpu/d3d12/SDL_gpu_d3d12.c +++ b/src/gpu/d3d12/SDL_gpu_d3d12.c @@ -3483,7 +3483,9 @@ static SDL_GPUTexture *D3D12_CreateTexture( // Copy properties so we don't lose information when the client destroys them container->header.info = *createinfo; container->header.info.props = SDL_CreateProperties(); - SDL_CopyProperties(createinfo->props, container->header.info.props); + if (createinfo->props) { + SDL_CopyProperties(createinfo->props, container->header.info.props); + } container->textureCapacity = 1; container->textureCount = 1; diff --git a/src/gpu/metal/SDL_gpu_metal.m b/src/gpu/metal/SDL_gpu_metal.m index 4ab1020666..de9df7274c 100644 --- a/src/gpu/metal/SDL_gpu_metal.m +++ b/src/gpu/metal/SDL_gpu_metal.m @@ -1494,7 +1494,9 @@ static SDL_GPUTexture *METAL_CreateTexture( // Copy properties so we don't lose information when the client destroys them container->header.info = *createinfo; container->header.info.props = SDL_CreateProperties(); - SDL_CopyProperties(createinfo->props, container->header.info.props); + if (createinfo->props) { + SDL_CopyProperties(createinfo->props, container->header.info.props); + } container->activeTexture = texture; container->textureCapacity = 1; diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index bf29e9c323..8638dd82ca 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -6775,7 +6775,9 @@ static SDL_GPUTexture *VULKAN_CreateTexture( // Copy properties so we don't lose information when the client destroys them container->header.info = *createinfo; container->header.info.props = SDL_CreateProperties(); - SDL_CopyProperties(createinfo->props, container->header.info.props); + if (createinfo->props) { + SDL_CopyProperties(createinfo->props, container->header.info.props); + } container->canBeCycled = true; container->activeTexture = texture;