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
dadcdb71
Commit
dadcdb71
authored
Jul 21, 2011
by
Jay Yang
Committed by
Alexandre Julliard
Jul 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
explorer: Fix various memory leaks.
parent
54ca4034
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
explorer.c
programs/explorer/explorer.c
+18
-7
No files found.
programs/explorer/explorer.c
View file @
dadcdb71
...
...
@@ -62,8 +62,9 @@ typedef struct
IExplorerBrowser
*
browser
;
HWND
main_window
,
path_box
;
INT
rebar_height
;
LP
C
ITEMIDLIST
pidl
;
LPITEMIDLIST
pidl
;
IImageList
*
icon_list
;
DWORD
advise_cookie
;
}
explorer_info
;
enum
...
...
@@ -139,6 +140,7 @@ static BOOL create_combobox_item(IShellFolder *folder, LPCITEMIDLIST pidl, IImag
&
icon_index
,
&
icon_flags
);
IExtractIconW_Extract
(
extract_icon
,
icon_file
,
icon_index
,
NULL
,
&
icon
,
20
);
item
->
iImage
=
ImageList_AddIcon
((
HIMAGELIST
)
icon_list
,
icon
);
IExtractIconW_Release
(
extract_icon
);
}
else
{
...
...
@@ -179,12 +181,14 @@ static void update_path_box(explorer_info *info)
if
(
SUCCEEDED
(
IShellFolder_EnumObjects
(
desktop
,
NULL
,
SHCONTF_FOLDERS
,
&
ids
))
&&
ids
!=
NULL
)
{
LPITEMIDLIST
curr_pidl
;
LPITEMIDLIST
curr_pidl
=
NULL
;
HRESULT
hres
;
item
.
iIndent
=
1
;
while
(
1
)
{
ILFree
(
curr_pidl
);
curr_pidl
=
NULL
;
hres
=
IEnumIDList_Next
(
ids
,
1
,
&
curr_pidl
,
NULL
);
if
(
FAILED
(
hres
)
||
hres
==
S_FALSE
)
break
;
...
...
@@ -245,6 +249,8 @@ static void update_path_box(explorer_info *info)
CoTaskMemFree
(
item
.
pszText
);
}
}
ILFree
(
curr_pidl
);
IEnumIDList_Release
(
ids
);
}
else
WINE_WARN
(
"Could not enumerate the desktop
\n
"
);
...
...
@@ -255,7 +261,8 @@ static void update_path_box(explorer_info *info)
static
HRESULT
WINAPI
IExplorerBrowserEventsImpl_fnOnNavigationComplete
(
IExplorerBrowserEvents
*
iface
,
PCIDLIST_ABSOLUTE
pidl
)
{
IExplorerBrowserEventsImpl
*
This
=
impl_from_IExplorerBrowserEvents
(
iface
);
This
->
info
->
pidl
=
pidl
;
ILFree
(
This
->
info
->
pidl
);
This
->
info
->
pidl
=
ILClone
(
pidl
);
update_path_box
(
This
->
info
);
return
S_OK
;
}
...
...
@@ -292,9 +299,9 @@ static IExplorerBrowserEvents *make_explorer_events(explorer_info *info)
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IExplorerBrowserEventsImpl
));
ret
->
IExplorerBrowserEvents_iface
.
lpVtbl
=
&
vt_IExplorerBrowserEvents
;
ret
->
info
=
info
;
ret
->
ref
=
1
;
SHGetImageList
(
SHIL_SMALL
,
&
IID_IImageList
,(
void
**
)
&
(
ret
->
info
->
icon_list
));
SendMessageW
(
info
->
path_box
,
CBEM_SETIMAGELIST
,
0
,(
LPARAM
)
ret
->
info
->
icon_list
);
IExplorerBrowserEvents_AddRef
(
&
ret
->
IExplorerBrowserEvents_iface
);
return
&
ret
->
IExplorerBrowserEvents_iface
;
}
...
...
@@ -306,7 +313,6 @@ static void make_explorer_window(IShellFolder* startFolder)
IExplorerBrowserEvents
*
events
;
explorer_info
*
info
;
HRESULT
hres
;
DWORD
cookie
;
WCHAR
explorer_title
[
100
];
WCHAR
pathbox_label
[
50
];
TBADDBITMAP
bitmap_info
;
...
...
@@ -318,7 +324,7 @@ static void make_explorer_window(IShellFolder* startFolder)
sizeof
(
explorer_title
)
/
sizeof
(
WCHAR
));
LoadStringW
(
explorer_hInstance
,
IDS_PATHBOX_LABEL
,
pathbox_label
,
sizeof
(
pathbox_label
)
/
sizeof
(
WCHAR
));
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
explorer_info
));
info
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
explorer_info
));
if
(
!
info
)
{
WINE_ERR
(
"Could not allocate a explorer_info struct
\n
"
);
...
...
@@ -402,7 +408,7 @@ static void make_explorer_window(IShellFolder* startFolder)
band_info
.
hwndChild
=
info
->
path_box
;
SendMessageW
(
rebar
,
RB_INSERTBANDW
,
-
1
,(
LPARAM
)
&
band_info
);
events
=
make_explorer_events
(
info
);
IExplorerBrowser_Advise
(
info
->
browser
,
events
,
&
cookie
);
IExplorerBrowser_Advise
(
info
->
browser
,
events
,
&
info
->
advise_
cookie
);
IExplorerBrowser_BrowseToObject
(
info
->
browser
,(
IUnknown
*
)
startFolder
,
SBSP_ABSOLUTE
);
ShowWindow
(
info
->
main_window
,
SW_SHOWDEFAULT
);
...
...
@@ -532,8 +538,13 @@ static LRESULT CALLBACK explorer_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, L
switch
(
uMsg
)
{
case
WM_DESTROY
:
IExplorerBrowser_Unadvise
(
browser
,
info
->
advise_cookie
);
IExplorerBrowser_Destroy
(
browser
);
IExplorerBrowser_Release
(
browser
);
ILFree
(
info
->
pidl
);
IImageList_Release
(
info
->
icon_list
);
HeapFree
(
GetProcessHeap
(),
0
,
info
);
SetWindowLongPtrW
(
hwnd
,
EXPLORER_INFO_INDEX
,
0
);
PostQuitMessage
(
0
);
break
;
case
WM_QUIT
:
...
...
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