Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6db1d3c5
Commit
6db1d3c5
authored
Aug 21, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 23, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/imagelist: Fix reference leak in IImageList_Clone().
parent
87847aa1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
imagelist.c
dlls/comctl32/imagelist.c
+9
-4
imagelist.c
dlls/comctl32/tests/imagelist.c
+13
-2
No files found.
dlls/comctl32/imagelist.c
View file @
6db1d3c5
...
...
@@ -3392,16 +3392,21 @@ static HRESULT WINAPI ImageListImpl_Merge(IImageList *iface, int i1,
static
HRESULT
WINAPI
ImageListImpl_Clone
(
IImageList
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
HIMAGELIST
This
=
(
HIMAGELIST
)
iface
;
HIMAGELIST
hNew
;
HIMAGELIST
clone
;
HRESULT
ret
=
E_FAIL
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppv
);
hNew
=
ImageList_Duplicate
(
This
);
clone
=
ImageList_Duplicate
(
This
);
/* Get the interface for the new image list */
if
(
hNew
)
ret
=
HIMAGELIST_QueryInterface
(
hNew
,
riid
,
ppv
);
if
(
clone
)
{
IImageList
*
iclone
=
(
IImageList
*
)
clone
;
ret
=
HIMAGELIST_QueryInterface
(
clone
,
riid
,
ppv
);
IImageList_Release
(
iclone
);
}
return
ret
;
}
...
...
dlls/comctl32/tests/imagelist.c
View file @
6db1d3c5
...
...
@@ -1332,7 +1332,7 @@ cleanup:
static
void
test_iimagelist
(
void
)
{
IImageList
*
imgl
;
IImageList
*
imgl
,
*
imgl2
;
HIMAGELIST
himl
;
HRESULT
hr
;
ULONG
ret
;
...
...
@@ -1364,6 +1364,15 @@ static void test_iimagelist(void)
ret
=
ImageList_Destroy
((
HIMAGELIST
)
imgl
);
ok
(
ret
==
FALSE
,
"Expected FALSE, got %d
\n
"
,
ret
);
/* ref counting, HIMAGELIST_QueryInterface adds a reference */
imgl
=
(
IImageList
*
)
createImageList
(
32
,
32
);
hr
=
pHIMAGELIST_QueryInterface
((
HIMAGELIST
)
imgl
,
&
IID_IImageList
,
(
void
**
)
&
imgl2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
imgl2
==
imgl
,
"got different pointer
\n
"
);
ret
=
IImageList_Release
(
imgl
);
ok
(
ret
==
1
,
"got %u
\n
"
,
ret
);
IImageList_Release
(
imgl
);
if
(
!
pImageList_CoCreateInstance
)
{
win_skip
(
"Vista imagelist functions not available
\n
"
);
...
...
@@ -1783,6 +1792,7 @@ static void test_IImageList_Clone(void)
IImageList
*
imgl
,
*
imgl2
;
HIMAGELIST
himl
;
HRESULT
hr
;
ULONG
ref
;
himl
=
ImageList_Create
(
16
,
16
,
ILC_COLOR16
,
0
,
3
);
imgl
=
(
IImageList
*
)
himl
;
...
...
@@ -1795,7 +1805,8 @@ if (0)
hr
=
IImageList_Clone
(
imgl
,
&
IID_IImageList
,
(
void
**
)
&
imgl2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
IImageList_Release
(
imgl2
);
ref
=
IImageList_Release
(
imgl2
);
ok
(
ref
==
0
,
"got %u
\n
"
,
ref
);
IImageList_Release
(
imgl
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment