https://issues.apache.org/ooo/show_bug.cgi?id=123914

--- Comment #9 from Armin Le Grand <[email protected]> ---
Compared with a simple HelloWorld doc which works, inside SwDoc::CreateCopy the
HelloWorld does not set xTmpDocShell in the created copy of SwDoc while in the
bugdoc it gets set from the following stack:

>       sw.dll!SwDoc::SetTmpDocShell(SfxObjectShellLock rLock)  Line 1849       
> C++
     sw.dll!SwOLENode::MakeCopy(SwDoc * pDoc, const SwNodeIndex & rIdx)  Line
467    C++
     sw.dll!SwNodes::_CopyNodes(const SwNodeRange & rRange, const SwNodeIndex &
rIndex, unsigned char bNewFrms, unsigned char bTblInsDummyNode)  Line 2161 +
0x45 bytes    C++
     sw.dll!SwDoc::CopyWithFlyInFly(const SwNodeRange & rRg, const unsigned
short nEndContentIndex, const SwNodeIndex & rInsPos, const SwPaM * pCopiedPaM,
const unsigned char bMakeNewFrms, const unsigned char bDelRedlines, const
unsigned char bCopyFlyAtFly)  Line 1343    C++
     sw.dll!SwDoc::CopyLayoutFmt(const SwFrmFmt & rSource, const SwFmtAnchor &
rNewAnchor, bool bSetTxtFlyAtt, bool bMakeFrms)  Line 503    C++
     sw.dll!SwDoc::CopyFlyInFlyImpl(const SwNodeRange & rRg, const unsigned
short nEndContentIndex, const SwNodeIndex & rStartIdx, const bool
bCopyFlyAtFly)  Line 1606 + 0x22 bytes    C++
     sw.dll!SwDoc::CopyWithFlyInFly(const SwNodeRange & rRg, const unsigned
short nEndContentIndex, const SwNodeIndex & rInsPos, const SwPaM * pCopiedPaM,
const unsigned char bMakeNewFrms, const unsigned char bDelRedlines, const
unsigned char bCopyFlyAtFly)  Line 1371    C++
     sw.dll!SwDoc::CopyImpl(SwPaM & rPam, SwPosition & rPos, const bool
bMakeNewFrms, const bool bCopyAll, SwPaM * const pCpyRange)  Line 1262    C++
     sw.dll!SwDoc::CopyRange(SwPaM & rPam, SwPosition & rPos, const bool
bCopyAll)  Line 732 + 0x21 bytes    C++
     sw.dll!SwDoc::Paste(const SwDoc & rSource)  Line 1242    C++
     sw.dll!SwDoc::CreateCopy(bool bCallInitNew)  Line 1205    C++
     sw.dll!SwXTextDocument::createClone()  Line 3254 + 0x17 bytes    C++
     sw.dll!SwNewDBMgr::MergeDocuments(SwMailMergeConfigItem & rMMConfig,
SwView & rSourceView)  Line 2935 + 0x32 bytes    C++
     swui.dll!SwMailMergeWizard::CreateTargetDocument()  Line 304    C++
    
swui.dll!SwMailMergePrepareMergePage::commitPage(svt::WizardTypes::CommitPageReason
_eReason)  Line 196    C++

As can be seen when the doc contains an OLE container, SwOLENode::MakeCopy is
called which contains code to create and set a SfxObjectShell if none exists at
the local SwDoc. This - AFAIUnderstandThis - gives the ownership of the SwDoc
to the created SfxObjectShell via RefCounting. When then setting this to zero
in the mail merge of course the doc is deleted.
This means that all Writer docs containing OLEs will break the MailMerge
wizard. I will check what happens if I avoid that code in
SwOLENode::MakeCopy...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.

Reply via email to