fix regression in "tdf#119388 add new UNO listener/broadcaster"
Upon further inspection, I note that part
of the the code I added in
commit ec940941e0bd7db15c5cf7d43df82226e0d849dc
Author: Noel Grandin <noel.grandin@collabora.co.uk>
Date: Tue Aug 20 17:03:13 2019 +0200
tdf#119388 add new UNO listener/broadcaster
would never have been able to be hit. Re-arrange a little to fix that.
Change-Id: I537102d768591e5fa0ec2fb4b52b05dad4d26f29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151140
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 5d21e96..b7f00ff 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -196,18 +196,32 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/,
// are no shapes that need to know about them.
if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
return;
const SdrHint *pSdrHint = static_cast<const SdrHint*>( &rHint );
if (pSdrHint->GetObject() )
return;
OSL_ENSURE( mpDrawModel, "draw model listener is disposed" );
if( !mpDrawModel )
return;
const SdrHint *pSdrHint = static_cast<const SdrHint*>( &rHint );
document::EventObject aEvent;
if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
return;
// right now, we're only handling the specific event necessary to fix this performance problem
if (pSdrHint->GetKind() == SdrHintKind::ObjectChange)
{
auto pSdrObject = const_cast<SdrObject*>(pSdrHint->GetObject());
uno::Reference<drawing::XShape> xShape(pSdrObject->getUnoShape(), uno::UNO_QUERY);
std::unique_lock aGuard(maListenerMutex);
auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape);
for (auto it = itBegin; it != itEnd; ++it)
it->second->notifyShapeEvent(aEvent);
}
if (pSdrHint->GetObject() )
return;
{
std::unique_lock g(maListenerMutex);
::comphelper::OInterfaceIteratorHelper4 aIter( g, maEventListeners );
@@ -224,16 +238,6 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/,
}
}
// right now, we're only handling the specific event necessary to fix this performance problem
if (pSdrHint->GetKind() == SdrHintKind::ObjectChange)
{
auto pSdrObject = const_cast<SdrObject*>(pSdrHint->GetObject());
uno::Reference<drawing::XShape> xShape(pSdrObject->getUnoShape(), uno::UNO_QUERY);
std::unique_lock aGuard(maListenerMutex);
auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape);
for (auto it = itBegin; it != itEnd; ++it)
it->second->notifyShapeEvent(aEvent);
}
}
void SwDrawModellListener_Impl::Dispose()