diff --git a/DirectXTex/DirectXTexUtil.cpp b/DirectXTex/DirectXTexUtil.cpp index fbd53f7..ffc347b 100644 --- a/DirectXTex/DirectXTexUtil.cpp +++ b/DirectXTex/DirectXTexUtil.cpp @@ -277,10 +277,13 @@ IWICImagingFactory* DirectX::GetWICFactory(bool& iswic2) noexcept static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT; - InitOnceExecuteOnce(&s_initOnce, + if (!InitOnceExecuteOnce(&s_initOnce, InitializeWICFactory, nullptr, - reinterpret_cast(&g_Factory)); + reinterpret_cast(&g_Factory))) + { + return nullptr; + } iswic2 = g_WIC2; return g_Factory; diff --git a/ScreenGrab/ScreenGrab.cpp b/ScreenGrab/ScreenGrab.cpp index df74a7a..78bf6e8 100644 --- a/ScreenGrab/ScreenGrab.cpp +++ b/ScreenGrab/ScreenGrab.cpp @@ -751,10 +751,13 @@ namespace static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT; IWICImagingFactory* factory = nullptr; - InitOnceExecuteOnce(&s_initOnce, + if (!InitOnceExecuteOnce(&s_initOnce, InitializeWICFactory, nullptr, - reinterpret_cast(&factory)); + reinterpret_cast(&factory))) + { + return nullptr; + } return factory; } diff --git a/ScreenGrab/ScreenGrab12.cpp b/ScreenGrab/ScreenGrab12.cpp index 8aaa5de..c977229 100644 --- a/ScreenGrab/ScreenGrab12.cpp +++ b/ScreenGrab/ScreenGrab12.cpp @@ -828,10 +828,13 @@ namespace static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT; IWICImagingFactory2* factory = nullptr; - (void)InitOnceExecuteOnce(&s_initOnce, + if (!InitOnceExecuteOnce(&s_initOnce, InitializeWICFactory, nullptr, - reinterpret_cast(&factory)); + reinterpret_cast(&factory))) + { + return nullptr; + } return factory; } diff --git a/WICTextureLoader/WICTextureLoader.cpp b/WICTextureLoader/WICTextureLoader.cpp index 240700c..5e256d7 100644 --- a/WICTextureLoader/WICTextureLoader.cpp +++ b/WICTextureLoader/WICTextureLoader.cpp @@ -208,10 +208,13 @@ namespace static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT; IWICImagingFactory* factory = nullptr; - (void)InitOnceExecuteOnce(&s_initOnce, + if (!InitOnceExecuteOnce(&s_initOnce, InitializeWICFactory, nullptr, - reinterpret_cast(&factory)); + reinterpret_cast(&factory))) + { + return nullptr; + } return factory; } diff --git a/WICTextureLoader/WICTextureLoader12.cpp b/WICTextureLoader/WICTextureLoader12.cpp index 45cb828..0b86bd8 100644 --- a/WICTextureLoader/WICTextureLoader12.cpp +++ b/WICTextureLoader/WICTextureLoader12.cpp @@ -166,10 +166,13 @@ namespace static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT; IWICImagingFactory2* factory = nullptr; - (void)InitOnceExecuteOnce(&s_initOnce, + if (!InitOnceExecuteOnce(&s_initOnce, InitializeWICFactory, nullptr, - reinterpret_cast(&factory)); + reinterpret_cast(&factory))) + { + return nullptr; + } return factory; }