From 328416e015174778d11e982fd56f2cb59b0a5168 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 26 Mar 2024 12:11:13 +0500 Subject: [PATCH] This assert was wrong In commit e2bfc34d146806a8f96be0cd2323d716f12cba4e (Reimplement OleComponentNative_Impl to use IGlobalInterfaceTable, 2024-03-11), I added the assert in a false assumption that RunObject may only be called once. Indeed, this is not so. Thus just make sure to not try to register it second time. Change-Id: I36fc4f3939bd0061e462659749bba8e4bd3075ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165299 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- embeddedobj/source/msole/olecomponent.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index edbeebb3c0b3..b9c1c27827bb 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -201,7 +201,8 @@ private: template void registerInterface(T* pInterface, DWORD& cookie) { - assert(cookie == 0); // do not set again + if (cookie != 0) // E.g., on subsequent RunObject calls + return; HRESULT hr = m_pGlobalTable->RegisterInterfaceInGlobal(pInterface, __uuidof(T), &cookie); SAL_WARN_IF(FAILED(hr), "embeddedobj.ole", "RegisterInterfaceInGlobal failed"); }