From 892c16e6611fa70c28558c93ac3228617fb1fa15 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 22 Nov 2012 18:26:28 +0800 Subject: [PATCH] windowscodecs: Reimplement GetFrameCount of the GIF decoder. --- dlls/windowscodecs/gifformat.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c index 4fa10e0400d..eb8a37be4f1 100644 --- a/dlls/windowscodecs/gifformat.c +++ b/dlls/windowscodecs/gifformat.c @@ -1241,13 +1241,14 @@ static HRESULT WINAPI GifDecoder_GetFrameCount(IWICBitmapDecoder *iface, UINT *pCount) { GifDecoder *This = impl_from_IWICBitmapDecoder(iface); - TRACE("(%p,%p)\n", iface, pCount); - if (!This->initialized) return WINCODEC_ERR_NOTINITIALIZED; + if (!pCount) return E_INVALIDARG; - *pCount = This->gif->ImageCount; + EnterCriticalSection(&This->lock); + *pCount = This->gif ? This->gif->ImageCount : 0; + LeaveCriticalSection(&This->lock); - TRACE("<- %u\n", *pCount); + TRACE("(%p) <-- %d\n", iface, *pCount); return S_OK; }