summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Orderud <fredrik.orderud@ge.com>2017-01-05 21:44:33 +0100
committerFredrik Orderud <forderud@gmail.com>2017-01-09 12:48:51 +0000
commitb36beaa453fb855e943205ad28155e1b120c364a (patch)
tree8ebf361b20b54b961dec73f98fb0e7366aab99d0
parente206842637d92f25edefe1e6572fc8d81683270e (diff)
downloadqtactiveqt-b36beaa453fb855e943205ad28155e1b120c364a.tar.gz
Enable failure recovery from crashing out-of-process control
As of today, crashing out-of-process controls are not cleaned up properly in the container. Also, an assertion failure is triggered when running in debug. ActiveQt should be hardened to more gracefully deal with out-of-process controls that crash without leaving the container in an inconsistent state. Change-Id: Ifa4d4375e7c811a72413abffe19731aad6be9ae9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-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);
}