summaryrefslogtreecommitdiffstats
path: root/src/activeqt/container/qaxwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/activeqt/container/qaxwidget.cpp')
-rw-r--r--src/activeqt/container/qaxwidget.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index 8c74159..3e927f4 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -759,8 +759,20 @@ void QAxClientSite::releaseAll()
void QAxClientSite::deactivate()
{
- if (m_spInPlaceObject) m_spInPlaceObject->InPlaceDeactivate();
- // if this assertion fails the control didn't call OnInPlaceDeactivate
+ if (!m_spInPlaceObject)
+ return;
+
+ // InPlaceDeactivate should trigger an OnInPlaceDeactivate callback
+ HRESULT hr = m_spInPlaceObject->InPlaceDeactivate();
+
+ // call fails if an out-of-process control crashes
+ if (FAILED(hr)) {
+ // Call OnInPlaceDeactivate directly to clean up
+ OnInPlaceDeactivate();
+ // schedule release of QAxClientSite references that were held by the control
+ CoDisconnectObject(static_cast<IUnknown *>(static_cast<IDispatch *>(this)), 0);
+ }
+
Q_ASSERT(m_spInPlaceObject == 0);
}