diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2025-01-18 19:46:49 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2025-01-19 13:21:42 +0100 |
commit | c31c20a06540b4066e34de6cb320c0317840a952 (patch) | |
tree | 7164e5afb06687d1bb554a9fcf1e6eda459726d6 /extensions/source | |
parent | b197379e867087413be86bd1a32030b912ecaa8a (diff) |
Use IID_PPV_ARGS and CComPtr to simplify
IID_PPV_ARGS allows to avoid reinterpret_casts (and also explicit
auto-deducible IIDs). Also, there always was a mismatch between the
type of mWebBrowser2 (which is IWebBrowser2) and the queried IID in
CSOActiveX::SetClientSite (which was IID_IWebBrowser, instead of
the correct IID_IWebBrowser2). Looks like in practice it wasn't a
problem, but now it's consistent.
Use of CComPtr in CSOActiveX::Load allows to release the pointer
correctly (previously, the call to Release was missing).
Change-Id: I29d672052780a36465f6143106c22fa2c90dab5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180448
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/activex/SOActiveX.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx index b72ab0d66ca0..9bb3b34a4afe 100644 --- a/extensions/source/activex/SOActiveX.cxx +++ b/extensions/source/activex/SOActiveX.cxx @@ -146,7 +146,7 @@ CSOActiveX::CSOActiveX() , mbDrawLocked( false ) { CLSID const clsFactory = {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}}; - HRESULT hr = CoCreateInstance( clsFactory, nullptr, CLSCTX_ALL, __uuidof(IDispatch), reinterpret_cast<void**>(&mpDispFactory)); + HRESULT hr = CoCreateInstance(clsFactory, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&mpDispFactory)); if( !SUCCEEDED( hr ) ) OutputError_Impl( nullptr, hr ); @@ -303,8 +303,8 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPER { mnVersion = GetVersionConnected(); - IPropertyBag2* pPropBag2; - HRESULT hr = pPropBag->QueryInterface( IID_IPropertyBag2, reinterpret_cast<void**>(&pPropBag2) ); + CComPtr<IPropertyBag2> pPropBag2; + HRESULT hr = pPropBag->QueryInterface(&pPropBag2); //ATLASSERT( hr >= 0 ); if( !SUCCEEDED( hr ) ) @@ -1096,9 +1096,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CSOActiveX::SetClientSite( IOleClientSite* aCl if( aServiceProvider ) { - aServiceProvider->QueryService( SID_SInternetExplorer, - IID_IWebBrowser, - reinterpret_cast<void**>(&mWebBrowser2) ); + aServiceProvider->QueryService(SID_SInternetExplorer, IID_PPV_ARGS(&mWebBrowser2)); // ATLASSERT( mWebBrowser2 ); if( mWebBrowser2 ) AtlAdvise( mWebBrowser2, GetUnknown(), DIID_DWebBrowserEvents2, &mCookie ); |