Piotr Caban : windowscodecs: Store stream reference in png decoder.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Mar 13 08:44:24 CDT 2015
Module: wine
Branch: master
Commit: 531992c760a34b2bb38d43b53f021a4440343a41
URL: http://source.winehq.org/git/wine.git/?a=commit;h=531992c760a34b2bb38d43b53f021a4440343a41
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Mar 12 10:17:19 2015 +0100
windowscodecs: Store stream reference in png decoder.
---
dlls/windowscodecs/pngformat.c | 5 +++++
dlls/windowscodecs/tests/pngformat.c | 4 +++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index 59b1976..260330f 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -296,6 +296,7 @@ typedef struct {
IWICBitmapFrameDecode IWICBitmapFrameDecode_iface;
IWICMetadataBlockReader IWICMetadataBlockReader_iface;
LONG ref;
+ IStream *stream;
png_structp png_ptr;
png_infop info_ptr;
png_infop end_info;
@@ -366,6 +367,7 @@ static ULONG WINAPI PngDecoder_Release(IWICBitmapDecoder *iface)
if (ref == 0)
{
+ IStream_Release(This->stream);
if (This->png_ptr)
ppng_destroy_read_struct(&This->png_ptr, &This->info_ptr, &This->end_info);
This->lock.DebugInfo->Spare[0] = 0;
@@ -605,6 +607,9 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p
ppng_read_end(This->png_ptr, This->end_info);
+ This->stream = pIStream;
+ IStream_AddRef(This->stream);
+
This->initialized = TRUE;
end:
diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c
index af50daa..bf370a3 100644
--- a/dlls/windowscodecs/tests/pngformat.c
+++ b/dlls/windowscodecs/tests/pngformat.c
@@ -283,6 +283,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);
@@ -300,7 +301,8 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
ok(IsEqualGUID(&format, &GUID_ContainerFormatPng),
"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;
}
More information about the wine-cvs
mailing list