Thomas Faber : shell32: Use QueryInterface in FolderView_GetFolder.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jun 30 10:07:58 CDT 2015
Module: wine
Branch: master
Commit: e582495927c253ddb5b6e5b01d3cf845207bdc10
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e582495927c253ddb5b6e5b01d3cf845207bdc10
Author: Thomas Faber <thomas.faber at reactos.org>
Date: Mon Jun 29 15:39:25 2015 -0400
shell32: Use QueryInterface in FolderView_GetFolder.
test_IFolderView has a test that shows that the shell folder's reference
count before and after the call to IFolderView_GetFolder is the same.
However this is misleading because it is not a property of the
IFolderView_GetFolder method, but of the desktop shell folder object
that's used in the folder view. Windows <=2003 uses a cached object and
its AddRef/Release methods return constants.
---
dlls/shell32/pidl.c | 1 +
dlls/shell32/shlview.c | 10 +---------
dlls/shell32/tests/ebrowser.c | 2 +-
dlls/shell32/tests/shlview.c | 6 ++++++
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index d16ca57..1856c12 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -1477,6 +1477,7 @@ HRESULT WINAPI SHGetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE *ppidl)
{
/* We might be able to get IPersistFolder2 from a shellfolder. */
ret = SHGetIDListFromObject((IUnknown*)psf, ppidl);
+ IShellFolder_Release(psf);
}
IFolderView_Release(pfv);
return ret;
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index e6691f8..b763468 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -2713,15 +2713,7 @@ static HRESULT WINAPI FolderView_GetFolder(IFolderView2 *iface, REFIID riid, voi
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
- if (!ppv) return E_POINTER;
-
- if (IsEqualIID(riid, &IID_IShellFolder))
- {
- *ppv = This->pSFParent;
- return S_OK;
- }
-
- return E_NOINTERFACE;
+ return IShellFolder_QueryInterface(This->pSFParent, riid, ppv);
}
static HRESULT WINAPI FolderView_Item(IFolderView2 *iface, int index, PITEMID_CHILD *ppidl)
diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c
index 4c255a1..c9d81a4 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -1469,7 +1469,7 @@ static void test_navigation(void)
test_browse_pidl_sb(peb2, &ebev, pidl_relative, SBSP_RELATIVE, S_OK, 1, 1, 0, 1);
ILFree(pidl_relative);
- /* IShellFolder_Release(psf); */
+ IShellFolder_Release(psf);
IFolderView_Release(pfv);
}
diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c
index 6525dd2..af57e60 100644
--- a/dlls/shell32/tests/shlview.c
+++ b/dlls/shell32/tests/shlview.c
@@ -688,6 +688,7 @@ static void test_IFolderView(void)
IShellBrowser *browser;
IFolderView2 *fv2;
IFolderView *fv;
+ IUnknown *unk;
HWND hwnd_view, hwnd_list;
PITEMID_CHILD pidl;
HRESULT hr;
@@ -830,6 +831,11 @@ if (0)
ok(ref1 == ref2 || ref1 + 1 == ref2, /* >= vista */
"expected same refcount, got %d\n", ref2);
ok(desktop == folder, "\n");
+ if (folder) IShellFolder_Release(folder);
+
+ hr = IFolderView_GetFolder(fv, &IID_IUnknown, (void**)&unk);
+ ok(hr == S_OK, "got (0x%08x)\n", hr);
+ if (unk) IUnknown_Release(unk);
hr = IFolderView_QueryInterface(fv, &IID_IFolderView2, (void**)&fv2);
if (hr != S_OK)
More information about the wine-cvs
mailing list