summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-25 13:20:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-25 13:27:42 +0100
commitc3f1dc1148593224aa77b1f4bdc3db1804adb07a (patch)
tree342e9f072cbaaaf02ce6c39ca3574b06176aa754
parent82fbf515a88feb1fd4f5e1028498674471a38a48 (diff)
Resolves: fdo#35937 temp ole docshell on dtor deletes SwDoc on 0 refcount
copy of ole objects creates a temp docshell, whose dtor on 0 ref count deletes the SwDoc handle. So add an acquire/release pair. (cherry picked from commit fb5c25294efd2ef9138df61e82cd438ff07f4bf1)
-rw-r--r--sw/source/core/doc/docnew.cxx31
1 files changed, 19 insertions, 12 deletions
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 0527ab95e7..6cc62a173a 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -1048,6 +1048,7 @@ void SwDoc::InitTOXTypes()
SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
{
SwDoc* pRet = new SwDoc;
+
//copy settings
sal_uInt16 aRangeOfDefaults[] = {
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
@@ -1058,22 +1059,24 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
0
};
- SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults );
-
- sal_uInt16 nWhich;
- sal_uInt16 nRange = 0;
- while( aRangeOfDefaults[nRange] != 0)
{
- for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich )
+ SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults );
+
+ sal_uInt16 nWhich;
+ sal_uInt16 nRange = 0;
+ while( aRangeOfDefaults[nRange] != 0)
{
- const SfxPoolItem& rSourceAttr = mpAttrPool->GetDefaultItem( nWhich );
- if( rSourceAttr != pRet->mpAttrPool->GetDefaultItem( nWhich ) )
- aNewDefaults.Put( rSourceAttr );
+ for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich )
+ {
+ const SfxPoolItem& rSourceAttr = mpAttrPool->GetDefaultItem( nWhich );
+ if( rSourceAttr != pRet->mpAttrPool->GetDefaultItem( nWhich ) )
+ aNewDefaults.Put( rSourceAttr );
+ }
+ nRange += 2;
}
- nRange += 2;
+ if( aNewDefaults.Count() )
+ pRet->SetDefault( aNewDefaults );
}
- if( aNewDefaults.Count() )
- pRet->SetDefault( aNewDefaults );
pRet->n32DummyCompatabilityOptions1 = n32DummyCompatabilityOptions1;
pRet->n32DummyCompatabilityOptions2 = n32DummyCompatabilityOptions2;
@@ -1117,12 +1120,16 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const
pRetShell->DoInitNew();
}
+ pRet->acquire();
+
//copy content
pRet->Paste( *this );
// remove the temporary shell if it is there as it was done before
pRet->SetTmpDocShell( (SfxObjectShell*)NULL );
+ pRet->release();
+
return pRetShell;
}