summaryrefslogtreecommitdiff
path: root/sw/source/ui/uno
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-28 11:44:02 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-28 11:44:02 +0100
commitabb716d15ea02bf3cbedd0dcce4395b7725ef8c5 (patch)
tree566c7eef18521702048a4bac05f985e18ff6facb /sw/source/ui/uno
parent64d0cdabe4e44c928eb170739163926620ca2b83 (diff)
parent1379283b49bd1acf89269ee569a2eb3aafd25376 (diff)
undoapi: pulled and merged DEV300.m98
Diffstat (limited to 'sw/source/ui/uno')
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx1
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx10
-rw-r--r--sw/source/ui/uno/unotxvw.cxx4
3 files changed, 10 insertions, 5 deletions
diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx
index 06b9e62b4a94..256d5737f7f5 100644
--- a/sw/source/ui/uno/unomailmerge.cxx
+++ b/sw/source/ui/uno/unomailmerge.cxx
@@ -201,6 +201,7 @@ static BOOL LoadFromURL_impl(
}
else
{
+ // SfxObjectShellRef is ok here, since the document will be explicitly closed
SfxObjectShellRef xTmpDocSh = pTmpDocShell;
CloseModelAndDocSh( xTmpModel, xTmpDocSh );
}
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index b0b95657600c..2dea6feb88c9 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -2591,7 +2591,7 @@ SwDoc * SwXTextDocument::GetRenderDoc(
const TypeId aSwViewTypeId = TYPE(SwView);
if (rpView && rpView->IsA(aSwViewTypeId))
{
- SfxObjectShellRef xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc());
+ SfxObjectShellLock xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc());
if (xDocSh.Is())
{
pDoc = ((SwDocShell*)&xDocSh)->GetDoc();
@@ -3170,8 +3170,12 @@ uno::Reference< util::XCloneable > SwXTextDocument::createClone( ) throw (uno::
::vos::OGuard aGuard(Application::GetSolarMutex());
if(!IsValid())
throw RuntimeException();
- //create a new document - hidden - copy the storage and return it
- SfxObjectShell* pShell = pDocShell->GetDoc()->CreateCopy(false);
+
+ // create a new document - hidden - copy the storage and return it
+ // SfxObjectShellRef is used here, since the model should control object lifetime after creation
+ // and thus SfxObjectShellLock is not allowed here
+ // the model holds reference to the shell, so the shell will not destructed at the end of method
+ SfxObjectShellRef pShell = pDocShell->GetDoc()->CreateCopy(false);
uno::Reference< frame::XModel > xNewModel = pShell->GetModel();
uno::Reference< embed::XStorage > xNewStorage = ::comphelper::OStorageHelper::GetTemporaryStorage( );
uno::Sequence< beans::PropertyValue > aTempMediaDescriptor;
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index c03935464abf..5f533bde3f22 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -903,12 +903,12 @@ void SAL_CALL SwXTextView::setRubyList(
/*-- 29.12.02 15:45:29---------------------------------------------------
-----------------------------------------------------------------------*/
-SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc()
+SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc()
{
SwWrtShell& rOldSh = m_pView->GetWrtShell();
SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false );
SwDocShell* pDocSh;
- SfxObjectShellRef xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) );
+ SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) );
xDocSh->DoInitNew( 0 );
SwDoc *const pTempDoc( pDocSh->GetDoc() );
// #i103634#, #i112425#: do not expand numbering and fields on PDF export