diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2011-01-03 13:40:23 +0100 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2011-01-03 13:40:23 +0100 |
commit | 07fa2a259a3c76b1cadc138d6e4bb23172210347 (patch) | |
tree | d6d623fa049f44127d3db430894cc2ab913dd281 /sw/source/ui/uno | |
parent | f1dc19695c083ec5f1356a2c082f2c4feb53aa33 (diff) |
fwk162: #i115902# review usage of SfxObjectShellRef, SfxObjecShellLock; remove unused some methods
Diffstat (limited to 'sw/source/ui/uno')
-rw-r--r-- | sw/source/ui/uno/unomailmerge.cxx | 1 | ||||
-rw-r--r-- | sw/source/ui/uno/unotxdoc.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/uno/unotxvw.cxx | 4 |
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 |