Skip to content

Commit 442f3f2

Browse files
committed
Fixed crash on exit with Win32 templates
1 parent 71c22db commit 442f3f2

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Src/WICTextureLoader.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,9 @@ namespace DirectX
158158

159159
IWICImagingFactory* _GetWIC()
160160
{
161-
static ComPtr<IWICImagingFactory> s_Factory;
162-
163-
if ( s_Factory )
164-
return s_Factory.Get();
165-
166161
static INIT_ONCE s_initOnce = INIT_ONCE_STATIC_INIT;
167162

163+
IWICImagingFactory* factory = nullptr;
168164
InitOnceExecuteOnce(&s_initOnce,
169165
[](PINIT_ONCE, PVOID, PVOID *factory) -> BOOL
170166
{
@@ -202,9 +198,9 @@ namespace DirectX
202198
__uuidof(IWICImagingFactory),
203199
factory) ) ? TRUE : FALSE;
204200
#endif
205-
}, nullptr, reinterpret_cast<LPVOID*>(s_Factory.GetAddressOf()));
201+
}, nullptr, reinterpret_cast<LPVOID*>(&factory));
206202

207-
return s_Factory.Get();
203+
return factory;
208204
}
209205

210206
} // namespace DirectX

0 commit comments

Comments
 (0)