David Hedberg : comdlg32: Fix reference counting when querying services.
Alexandre Julliard
julliard at winehq.org
Wed May 25 11:28:15 CDT 2011
Module: wine
Branch: master
Commit: 77cc26878c2c4ca3c801af8a642c123c67514daa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=77cc26878c2c4ca3c801af8a642c123c67514daa
Author: David Hedberg <david.hedberg at gmail.com>
Date: Tue May 24 21:09:47 2011 +0200
comdlg32: Fix reference counting when querying services.
---
dlls/comdlg32/itemdlg.c | 8 +-------
dlls/comdlg32/tests/itemdlg.c | 21 +++++++++++++++------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index 8612904..69d9661 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -1915,13 +1915,7 @@ static HRESULT WINAPI IServiceProvider_fnQueryService(IServiceProvider *iface,
FIXME("Interface %s requested from unknown service %s\n",
debugstr_guid(riid), debugstr_guid(guidService));
- if(SUCCEEDED(hr) && *ppv)
- {
- IUnknown_AddRef((IUnknown*)*ppv);
- return S_OK;
- }
-
- return E_FAIL;
+ return hr;
}
static const IServiceProviderVtbl vt_IServiceProvider = {
diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c
index 3653014..4dafa9b 100644
--- a/dlls/comdlg32/tests/itemdlg.c
+++ b/dlls/comdlg32/tests/itemdlg.c
@@ -157,6 +157,7 @@ static BOOL test_instantiation(void)
IServiceProvider *psp;
IUnknown *punk;
HRESULT hr;
+ LONG ref;
/* Instantiate FileOpenDialog */
hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
@@ -223,7 +224,8 @@ static BOOL test_instantiation(void)
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
- IFileOpenDialog_Release(pfod);
+ ref = IFileOpenDialog_Release(pfod);
+ ok(!ref, "Got refcount %d, should have been released.\n", ref);
/* Instantiate FileSaveDialog */
hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
@@ -267,7 +269,8 @@ static BOOL test_instantiation(void)
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
- IFileSaveDialog_Release(pfsd);
+ ref = IFileSaveDialog_Release(pfsd);
+ ok(!ref, "Got refcount %d, should have been released.\n", ref);
return TRUE;
}
@@ -284,6 +287,7 @@ static void test_basics(void)
LPITEMIDLIST pidl;
WCHAR *filename;
UINT filetype;
+ LONG ref;
HRESULT hr;
const WCHAR txt[] = {'t','x','t', 0};
const WCHAR null[] = {0};
@@ -735,8 +739,10 @@ static void test_basics(void)
/* Cleanup */
IShellItem_Release(psidesktop);
- IFileOpenDialog_Release(pfod);
- IFileSaveDialog_Release(pfsd);
+ ref = IFileOpenDialog_Release(pfod);
+ ok(!ref, "Got refcount %d, should have been released.\n", ref);
+ ref = IFileSaveDialog_Release(pfsd);
+ ok(!ref, "Got refcount %d, should have been released.\n", ref);
}
static void test_advise_helper(IFileDialog *pfd)
@@ -811,20 +817,23 @@ static void test_advise(void)
{
IFileDialog *pfd;
HRESULT hr;
+ LONG ref;
trace("Testing FileOpenDialog (advise)\n");
hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
&IID_IFileDialog, (void**)&pfd);
ok(hr == S_OK, "got 0x%08x.\n", hr);
test_advise_helper(pfd);
- IFileDialog_Release(pfd);
+ ref = IFileDialog_Release(pfd);
+ ok(!ref, "Got refcount %d, should have been released.\n", ref);
trace("Testing FileSaveDialog (advise)\n");
hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER,
&IID_IFileDialog, (void**)&pfd);
ok(hr == S_OK, "got 0x%08x.\n", hr);
test_advise_helper(pfd);
- IFileDialog_Release(pfd);
+ ref = IFileDialog_Release(pfd);
+ ok(!ref, "Got refcount %d, should have been released.\n", ref);
}
START_TEST(itemdlg)
More information about the wine-cvs
mailing list