tdf#126877 crash on inserting floating frame
regression from
commit 5043421fdc
Date: Fri Jul 19 14:05:10 2019 +0200
loplugin:referencecasting in embeddedobj
OSpecialEmbeddedObject is playing games and effectively "unimplementing"
an interface it's superclass implements by doing custom stuff in
OSpecialEmbeddedObject::queryInterface.
So lets rather implement this in a more direct and obvious way.
Change-Id: I341b8e0b6acafac80cbd55f745811b73d2593585
Reviewed-on: https://gerrit.libreoffice.org/77580
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -50,6 +50,7 @@
|
|||||||
#include <commonembobj.hxx>
|
#include <commonembobj.hxx>
|
||||||
#include <intercept.hxx>
|
#include <intercept.hxx>
|
||||||
#include "embedobj.hxx"
|
#include "embedobj.hxx"
|
||||||
|
#include <specialobject.hxx>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
@@ -173,6 +174,8 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
|
|||||||
m_xDocHolder->SetComponent( LoadLink_Impl(), m_bReadOnly );
|
m_xDocHolder->SetComponent( LoadLink_Impl(), m_bReadOnly );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ( !dynamic_cast<OSpecialEmbeddedObject*>(this) )
|
||||||
{
|
{
|
||||||
// in case embedded object is in loaded state the contents must
|
// in case embedded object is in loaded state the contents must
|
||||||
// be stored in the related storage and the storage
|
// be stored in the related storage and the storage
|
||||||
@@ -182,6 +185,22 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
|
|||||||
|
|
||||||
m_xDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly );
|
m_xDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// objects without persistence will be initialized internally
|
||||||
|
uno::Sequence < uno::Any > aArgs(1);
|
||||||
|
aArgs[0] <<= uno::Reference < embed::XEmbeddedObject >( this );
|
||||||
|
uno::Reference< util::XCloseable > xDocument(
|
||||||
|
m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( GetDocumentServiceName(), aArgs, m_xContext),
|
||||||
|
uno::UNO_QUERY );
|
||||||
|
|
||||||
|
uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
|
||||||
|
if ( xChild.is() )
|
||||||
|
xChild->setParent( m_xParent );
|
||||||
|
|
||||||
|
m_xDocHolder->SetComponent( xDocument, m_bReadOnly );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !m_xDocHolder->GetComponent().is() )
|
if ( !m_xDocHolder->GetComponent().is() )
|
||||||
throw embed::UnreachableStateException(); //TODO: can't open document
|
throw embed::UnreachableStateException(); //TODO: can't open document
|
||||||
|
Reference in New Issue
Block a user