From cacf666f95df9790cebf5d5cdb0609cee257fab3 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 18 Oct 2017 10:26:28 +0200 Subject: Get the right interface type for m_spInPlaceSite We depend on m_spInPlaceSite being an IOleInPlaceSiteWindowless type as we call a function only available for that type and not the base one. Therefore, we need to have a pointer to both interfaces, so we can use the right one when needing IOleInPlaceSiteWindowless. Since not all controls provide IOleInPlaceSiteWindowless we need to have both in case IOleInPlaceSite is available. Task-number: QTBUG-63903 Change-Id: Ieaf039c169347606aec43f53c8cb29e1317db3b9 Reviewed-by: Friedemann Kleint --- src/activeqt/control/qaxserverbase.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index 2eb0a77..bfc4fc0 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -429,7 +429,8 @@ private: IAdviseSink *m_spAdviseSink; QList adviseSinks; IOleClientSite *m_spClientSite; - IOleInPlaceSiteWindowless *m_spInPlaceSite; + IOleInPlaceSite *m_spInPlaceSite; + IOleInPlaceSiteWindowless *m_spInPlaceSiteWindowless; IOleInPlaceFrame *m_spInPlaceFrame; ITypeInfo *m_spTypeInfo; IStorage *m_spStorage; @@ -1103,6 +1104,7 @@ void QAxServerBase::init() m_spAdviseSink = 0; m_spClientSite = 0; + m_spInPlaceSiteWindowless = 0; m_spInPlaceSite = 0; m_spInPlaceFrame = 0; m_spTypeInfo = 0; @@ -1158,6 +1160,9 @@ QAxServerBase::~QAxServerBase() m_spClientSite = 0; if (m_spInPlaceFrame) m_spInPlaceFrame->Release(); m_spInPlaceFrame = 0; + if (m_spInPlaceSiteWindowless) + m_spInPlaceSiteWindowless->Release(); + m_spInPlaceSiteWindowless = 0; if (m_spInPlaceSite) m_spInPlaceSite->Release(); m_spInPlaceSite = 0; if (m_spTypeInfo) m_spTypeInfo->Release(); @@ -1822,8 +1827,8 @@ void QAxServerBase::update() if (isInPlaceActive) { if (m_hWnd) ::InvalidateRect(m_hWnd, 0, true); - else if (m_spInPlaceSite) - m_spInPlaceSite->InvalidateRect(NULL, true); + else if (m_spInPlaceSiteWindowless) + m_spInPlaceSiteWindowless->InvalidateRect(NULL, true); } else if (m_spAdviseSink) { m_spAdviseSink->OnViewChange(DVASPECT_CONTENT, -1); for (int i = 0; i < adviseSinks.count(); ++i) { @@ -3759,6 +3764,9 @@ HRESULT WINAPI QAxServerBase::Close(DWORD dwSaveOption) m_spClientSite->OnShowWindow(false); } + if (m_spInPlaceSiteWindowless) + m_spInPlaceSiteWindowless->Release(); + m_spInPlaceSiteWindowless = 0; if (m_spInPlaceSite) m_spInPlaceSite->Release(); m_spInPlaceSite = 0; @@ -4019,6 +4027,9 @@ HRESULT WINAPI QAxServerBase::SetClientSite(IOleClientSite* pClientSite) { // release all client site interfaces if (m_spClientSite) m_spClientSite->Release(); + if (m_spInPlaceSiteWindowless) + m_spInPlaceSiteWindowless->Release(); + m_spInPlaceSiteWindowless = 0; if (m_spInPlaceSite) m_spInPlaceSite->Release(); m_spInPlaceSite = 0; if (m_spInPlaceFrame) m_spInPlaceFrame->Release(); @@ -4028,6 +4039,8 @@ HRESULT WINAPI QAxServerBase::SetClientSite(IOleClientSite* pClientSite) if (m_spClientSite) { m_spClientSite->AddRef(); m_spClientSite->QueryInterface(IID_IOleInPlaceSite, reinterpret_cast(&m_spInPlaceSite)); + m_spClientSite->QueryInterface(IID_IOleInPlaceSiteWindowless, + reinterpret_cast(&m_spInPlaceSiteWindowless)); } return S_OK; -- cgit v1.2.3