tdf#147503 don't use SfxObjectShellLock for new xml forms document
because in the hidden case the document is unexpectedly closed on
leaving NewXForms
Change-Id: I00ea0b8de6c10ff141584cefe3768b7071138393
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150891
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 5160d93..4bdb56e 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -287,7 +287,6 @@ IMPL_STATIC_LINK(SvxHyperlinkNewDocTp, DispatchDocument, void*, p, void)
{
SfxStringItem aNewName( SID_FILE_NAME, xExecuteInfo->aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
SfxUnoFrameItem aDocFrame( SID_FILLFRAME, pViewFrame->GetFrame().GetFrameInterface() );
fprintf(stderr, "is there a frame int %p\n", pViewFrame->GetFrame().GetFrameInterface().get() );
pViewFrame->GetDispatcher()->ExecuteList(
SID_SAVEASDOC, SfxCallMode::SYNCHRON,
{ &aNewName }, { &aDocFrame });
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 086002c..dcdb31a 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -1119,11 +1119,11 @@ void NewXForms( SfxRequest& rReq )
// copied & excerpted from SwModule::InsertLab(..)
// create new document
SfxObjectShellLock xDocSh( new SwDocShell( SfxObjectCreateMode::STANDARD) );
SwDocShellRef xDocSh( new SwDocShell( SfxObjectCreateMode::STANDARD) );
xDocSh->DoInitNew();
// initialize XForms
static_cast<SwDocShell*>( &xDocSh )->GetDoc()->initXForms( true );
xDocSh->GetDoc()->initXForms(true);
// load document into frame
SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );