From 18665e34a1853246408bc0298aa321e094d4de7d Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Tue, 11 Apr 2023 10:01:43 -0400 Subject: [PATCH] Fix Optick threadTLS nullptr check and OPTICK_SET_MEMORY_ALLOCATOR stub #define --- neo/libs/optick/optick.h | 2 +- neo/libs/optick/optick_core.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/neo/libs/optick/optick.h b/neo/libs/optick/optick.h index 3d57a07a..64ddb4a3 100644 --- a/neo/libs/optick/optick.h +++ b/neo/libs/optick/optick.h @@ -1096,7 +1096,7 @@ struct OptickApp #define OPTICK_STORAGE_PUSH(STORAGE, DESCRIPTION, CPU_TIMESTAMP_START) #define OPTICK_STORAGE_POP(STORAGE, CPU_TIMESTAMP_FINISH) #define OPTICK_SET_STATE_CHANGED_CALLBACK(CALLBACK) -#define OPTICK_SET_MEMORY_ALLOCATOR(ALLOCATE_FUNCTION, DEALLOCATE_FUNCTION) +#define OPTICK_SET_MEMORY_ALLOCATOR(ALLOCATE_FUNCTION, DEALLOCATE_FUNCTION, INIT_THREAD_CALLBACK) #define OPTICK_SHUTDOWN() #define OPTICK_GPU_INIT_D3D12(DEVICE, CMD_QUEUES, NUM_CMD_QUEUS) #define OPTICK_GPU_INIT_VULKAN(DEVICES, PHYSICAL_DEVICES, CMD_QUEUES, CMD_QUEUES_FAMILY, NUM_CMD_QUEUS, FUNCTIONS) diff --git a/neo/libs/optick/optick_core.h b/neo/libs/optick/optick_core.h index 9066433d..ba4e319c 100644 --- a/neo/libs/optick/optick_core.h +++ b/neo/libs/optick/optick_core.h @@ -337,7 +337,8 @@ struct ThreadEntry // https://github.com/ulricheck/optick/pull/1/commits/1e5e1919816a64f235caa0f4b0bf20495225b1fa ~ThreadEntry() { - if((*threadTLS)!=nullptr) + // SRS - check threadTLS for null before dereferencing, not *threadTLS + if (threadTLS != nullptr) { *threadTLS = nullptr; } @@ -650,4 +651,4 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } -#endif //USE_OPTICK \ No newline at end of file +#endif //USE_OPTICK