Commit b6811233 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

windowscodecs: Store stream reference in gif decoder.

parent a1819978
......@@ -578,6 +578,7 @@ static HRESULT create_metadata_reader(const void *data, int data_size,
typedef struct {
IWICBitmapDecoder IWICBitmapDecoder_iface;
IWICMetadataBlockReader IWICMetadataBlockReader_iface;
IStream *stream;
BYTE LSD_data[13]; /* Logical Screen Descriptor */
LONG ref;
BOOL initialized;
......@@ -1054,6 +1055,7 @@ static ULONG WINAPI GifDecoder_Release(IWICBitmapDecoder *iface)
if (ref == 0)
{
IStream_Release(This->stream);
This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock);
DGifCloseFile(This->gif);
......@@ -1141,6 +1143,9 @@ static HRESULT WINAPI GifDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p
IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL);
IStream_Read(pIStream, This->LSD_data, sizeof(This->LSD_data), NULL);
This->stream = pIStream;
IStream_AddRef(This->stream);
This->initialized = TRUE;
LeaveCriticalSection(&This->lock);
......
......@@ -67,6 +67,7 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
IWICBitmapDecoder *decoder = NULL;
IStream *stream;
GUID format;
LONG refcount;
hmem = GlobalAlloc(0, image_size);
data = GlobalLock(hmem);
......@@ -84,7 +85,8 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
IStream_Release(stream);
refcount = IStream_Release(stream);
ok(refcount > 0, "expected stream refcount > 0\n");
return decoder;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment