On 30/11/2022 11:45, Mike Kaganski wrote:
On 30.11.2022 13:18, Stephan Bergmann wrote:
If anybody has an (explicitly, or implicitly via --enable-debug or
--enable-dbgutil) --enable-sal-log Windows build for which
CppunitTest_embeddedobj_msole succeeds and fully executes that above
testSaveOnThread because it is run with 96 DPI (so that that above "96
DPI" check succeeds): I would be interested in the resulting
workdir/CppunitTest/embeddedobj_msole.test.log
So (after a bit more offline back and forth:) both of us get into the
if (hr == RPC_E_WRONG_THREAD)
{
// Assume that the OLE object was loaded on the main thread.
vcl::solarthread::syncExecute([this, &hr, &pDataObject, &aFormat, &aMedium]() {
// Make sure that the current state is embed::EmbedStates::RUNNING.
RunObject();
// Now try again on the correct thread.
hr = pDataObject->GetData(&aFormat, &aMedium);
});
}
block in OleComponent::GetExtent
(embeddedobj/source/msole/olecomponent.cxx) and into its call (done on a
different thread, by that syncExecute) of
void OleComponent::RunObject()
{
OSL_ENSURE( m_pNativeImpl->m_pOleObject, "The pointer can not be set to NULL here!" );
if ( !m_pNativeImpl->m_pOleObject )
throw embed::WrongStateException(); // TODO: the object is in wrong state
if ( !OleIsRunning( m_pNativeImpl->m_pOleObject ) )
{
HRESULT hr = OleRun( m_pNativeImpl->m_pObj );
if ( FAILED( hr ) )
{
if ( hr == REGDB_E_CLASSNOTREG )
throw embed::UnreachableStateException(); // the object server is not installed
else
throw io::IOException();
}
}
}
(also in embeddedobj/source/msole/olecomponent.cxx). Where things start
to differ is that while Mike's run apparently succeeds without throwing
an exception (so either OleIsRunning(...), or not FAILED(hr)), my run
goes into the hr == REGDB_E_CLASSNOTREG branch throwing an
UnreachableStateException (which that syncExecucte then rethrows on the
original thread).