diff options
author | Jim Raykowski <raykowj@gmail.com> | 2022-06-13 08:31:33 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2022-07-30 06:10:36 +0200 |
commit | 45312369331688bde9d1b8c97ad883a69e5982d7 (patch) | |
tree | c4ba8661a3fc8c1a171bb953a079245dc9643537 /sw | |
parent | d87f69cc7e5a6f5c8a79075fed343a14675f3a5d (diff) |
tdf#149467 fix re-entrance crash
This crash is caused by an odd re-entrance happening. In this case
re-entrance to SwContentTree::UpdateTracking happens when
SfxHintId::DocChanged is broadcast from SwDocShell::SetModified when
GetContentAtPos is called from SwContentTree::UpdateTracking which
eventually causes a stack crash.
Getting model position for view point when getting content at
position (GetContentAtPos call to GetModelPositionForViewPoint)
shouldn't set the document modification state. Which is what happens
using the steps to repro this crash.
This patch disallows setting document modification state during the
DocumentStylePoolManager::GetFormatFromPool call from
SwTextINetFormat::GetCharFormat.
backtrace of last 100 levels before crash:
1 SwTextFrame::GetModelPositionForViewPoint_ frmcrsr.cxx
551 0x7fffbddbde96
2 SwTextFrame::GetModelPositionForViewPoint frmcrsr.cxx
665 0x7fffbddbe891
3 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx
168 0x7fffbdcf6c08
4 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx
168 0x7fffbdcf6c08
5 SwPageFrame::GetModelPositionForViewPoint trvlfrm.cxx
211 0x7fffbdcf6f2f
6 SwRootFrame::GetModelPositionForViewPoint trvlfrm.cxx
452 0x7fffbdcf7fa0
7 SwCursorShell::GetContentAtPos crstrvl.cxx
1370 0x7fffbd581050
8 SwContentTree::UpdateTracking content.cxx
3700 0x7fffbe9864a0
9 SwContentTree::TimerUpdate content.cxx
3589 0x7fffbe985474
10 SwContentTree::Notify content.cxx
3047 0x7fffbe9811ad
11 SfxBroadcaster::Broadcast
SfxBroadcaster.cxx 40 0x7ffff4180f32
12 SwDocShell::SetModified docsh2.cxx
1446 0x7fffbe53b663
13 SwDocShell::Ole2ModifiedHdl docsh.cxx
1150 0x7fffbe52d660
14 SwDocShell::LinkStubOle2ModifiedHdl docsh.cxx
1131 0x7fffbe52d597
15 Link<bool, void>::Call link.hxx
111 0x7fffbd8889f5
16 sw::DocumentStateManager::SetModified
DocumentStateManager.cxx 50 0x7fffbd888729
17 SwDoc::MakeCharFormat docfmt.cxx
861 0x7fffbd6ef2b8
18 SwDoc::MakeCharFormat_ docfmt.cxx
883 0x7fffbd6ef43a
19 sw::DocumentStylePoolManager::GetFormatFromPool
DocumentStylePoolManager.cxx 1514 0x7fffbd89132c
20 sw::DocumentStylePoolManager::GetCharFormatFromPool
DocumentStylePoolManager.cxx 1718 0x7fffbd892d86
21 SwTextINetFormat::GetCharFormat txtatr2.cxx
144 0x7fffbdfa1a03
22 SwTextINetFormat::GetCharFormat txtinet.hxx
52 0x7fffbddb4f4e
23 CharFormat::GetItemSet atrstck.cxx
145 0x7fffbddb07e5
24 SwAttrHandler::PushAndChg atrstck.cxx
345 0x7fffbddb1047
25 SwAttrIter::Chg itratr.cxx
102 0x7fffbddf02db
26 SwAttrIter::SeekFwd itratr.cxx
296 0x7fffbddf1104
27 SwAttrIter::Seek itratr.cxx
419 0x7fffbddf17b3
28 SwAttrIter::SeekAndChgAttrIter itratr.cxx
158 0x7fffbddf06e2
29 SwTextIter::SeekAndChg itrtxt.hxx
313 0x7fffbde01791
30 SwTextCursor::GetModelPositionForViewPoint itrcrsr.cxx
1658 0x7fffbddff83f
31 SwTextFrame::GetModelPositionForViewPoint_ frmcrsr.cxx
604 0x7fffbddbe337
32 SwTextFrame::GetModelPositionForViewPoint frmcrsr.cxx
665 0x7fffbddbe891
33 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx
168 0x7fffbdcf6c08
34 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx
168 0x7fffbdcf6c08
35 SwPageFrame::GetModelPositionForViewPoint trvlfrm.cxx
211 0x7fffbdcf6f2f
36 SwRootFrame::GetModelPositionForViewPoint trvlfrm.cxx
452 0x7fffbdcf7fa0
37 SwCursorShell::GetContentAtPos crstrvl.cxx
1370 0x7fffbd581050
38 SwContentTree::UpdateTracking content.cxx
3700 0x7fffbe9864a0
39 SwContentTree::TimerUpdate content.cxx
3589 0x7fffbe985474
40 SwContentTree::Notify content.cxx
3047 0x7fffbe9811ad
41 SfxBroadcaster::Broadcast
SfxBroadcaster.cxx 40 0x7ffff4180f32
42 SwDocShell::SetModified docsh2.cxx
1446 0x7fffbe53b663
43 SwDocShell::Ole2ModifiedHdl docsh.cxx
1150 0x7fffbe52d660
44 SwDocShell::LinkStubOle2ModifiedHdl docsh.cxx
1131 0x7fffbe52d597
45 Link<bool, void>::Call link.hxx
111 0x7fffbd8889f5
46 sw::DocumentStateManager::SetModified
DocumentStateManager.cxx 50 0x7fffbd888729
47 SwDoc::MakeCharFormat docfmt.cxx
861 0x7fffbd6ef2b8
48 SwDoc::MakeCharFormat_ docfmt.cxx
883 0x7fffbd6ef43a
49 sw::DocumentStylePoolManager::GetFormatFromPool
DocumentStylePoolManager.cxx 1514 0x7fffbd89132c
50 sw::DocumentStylePoolManager::GetCharFormatFromPool
DocumentStylePoolManager.cxx 1718 0x7fffbd892d86
51 SwTextINetFormat::GetCharFormat txtatr2.cxx
144 0x7fffbdfa1a03
52 SwTextINetFormat::GetCharFormat txtinet.hxx
52 0x7fffbddb4f4e
53 CharFormat::GetItemSet atrstck.cxx
145 0x7fffbddb07e5
54 SwAttrHandler::PushAndChg atrstck.cxx
345 0x7fffbddb1047
55 SwAttrIter::Chg itratr.cxx
102 0x7fffbddf02db
56 SwAttrIter::SeekFwd itratr.cxx
296 0x7fffbddf1104
57 SwAttrIter::Seek itratr.cxx
419 0x7fffbddf17b3
58 SwAttrIter::SeekAndChgAttrIter itratr.cxx
158 0x7fffbddf06e2
59 SwTextIter::SeekAndChg itrtxt.hxx
313 0x7fffbde01791
60 SwTextCursor::GetModelPositionForViewPoint itrcrsr.cxx
1658 0x7fffbddff83f
61 SwTextFrame::GetModelPositionForViewPoint_ frmcrsr.cxx
604 0x7fffbddbe337
62 SwTextFrame::GetModelPositionForViewPoint frmcrsr.cxx
665 0x7fffbddbe891
63 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx
168 0x7fffbdcf6c08
64 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx
168 0x7fffbdcf6c08
65 SwPageFrame::GetModelPositionForViewPoint trvlfrm.cxx
211 0x7fffbdcf6f2f
66 SwRootFrame::GetModelPositionForViewPoint trvlfrm.cxx
452 0x7fffbdcf7fa0
67 SwCursorShell::GetContentAtPos crstrvl.cxx
1370 0x7fffbd581050
68 SwContentTree::UpdateTracking content.cxx
3700 0x7fffbe9864a0
69 SwContentTree::TimerUpdate content.cxx
3589 0x7fffbe985474
70 SwContentTree::Notify content.cxx
3047 0x7fffbe9811ad
71 SfxBroadcaster::Broadcast
SfxBroadcaster.cxx 40 0x7ffff4180f32
72 SwDocShell::SetModified docsh2.cxx
1446 0x7fffbe53b663
73 SwDocShell::Ole2ModifiedHdl docsh.cxx
1150 0x7fffbe52d660
74 SwDocShell::LinkStubOle2ModifiedHdl docsh.cxx
1131 0x7fffbe52d597
75 Link<bool, void>::Call link.hxx
111 0x7fffbd8889f5
76 sw::DocumentStateManager::SetModified
DocumentStateManager.cxx 50 0x7fffbd888729
77 SwDoc::MakeCharFormat docfmt.cxx
861 0x7fffbd6ef2b8
78 SwDoc::MakeCharFormat_ docfmt.cxx
883 0x7fffbd6ef43a
79 sw::DocumentStylePoolManager::GetFormatFromPool
DocumentStylePoolManager.cxx 1514 0x7fffbd89132c
80 sw::DocumentStylePoolManager::GetCharFormatFromPool
DocumentStylePoolManager.cxx 1718 0x7fffbd892d86
81 SwTextINetFormat::GetCharFormat txtatr2.cxx
144 0x7fffbdfa1a03
82 SwTextINetFormat::GetCharFormat txtinet.hxx
52 0x7fffbddb4f4e
83 CharFormat::GetItemSet atrstck.cxx
145 0x7fffbddb07e5
84 SwAttrHandler::PushAndChg atrstck.cxx
345 0x7fffbddb1047
85 SwAttrIter::Chg itratr.cxx
102 0x7fffbddf02db
86 SwAttrIter::SeekFwd itratr.cxx
296 0x7fffbddf1104
87 SwAttrIter::Seek itratr.cxx
419 0x7fffbddf17b3
88 SwAttrIter::SeekAndChgAttrIter itratr.cxx
158 0x7fffbddf06e2
89 SwTextIter::SeekAndChg itrtxt.hxx
313 0x7fffbde01791
90 SwTextCursor::GetModelPositionForViewPoint itrcrsr.cxx
1658 0x7fffbddff83f
91 SwTextFrame::GetModelPositionForViewPoint_ frmcrsr.cxx
604 0x7fffbddbe337
92 SwTextFrame::GetModelPositionForViewPoint frmcrsr.cxx
665 0x7fffbddbe891
93 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx
168 0x7fffbdcf6c08
94 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx
168 0x7fffbdcf6c08
95 SwPageFrame::GetModelPositionForViewPoint trvlfrm.cxx
211 0x7fffbdcf6f2f
96 SwRootFrame::GetModelPositionForViewPoint trvlfrm.cxx
452 0x7fffbdcf7fa0
97 SwCursorShell::GetContentAtPos crstrvl.cxx
1370 0x7fffbd581050
98 SwContentTree::UpdateTracking content.cxx
3700 0x7fffbe9864a0
99 SwContentTree::TimerUpdate content.cxx
3589 0x7fffbe985474
100 SwContentTree::Notify content.cxx
3047 0x7fffbe9811ad
Change-Id: I7e0814cf3a42dc876dd60c926d4b2245a036cc3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135802
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/txtnode/txtatr2.cxx | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index 96c905bb4d76..2b51b45ffbec 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -131,23 +131,14 @@ SwCharFormat* SwTextINetFormat::GetCharFormat() // JP 10.02.2000, Bug 72806: don't modify the doc for getting the // correct charstyle. - bool bResetMod = !rDoc.getIDocumentState().IsModified(); - Link<bool,void> aOle2Lnk; - if ( bResetMod ) - { - aOle2Lnk = rDoc.GetOle2Link(); - rDoc.SetOle2Link( Link<bool,void>() ); - } + bool bModifiedEnabled = rDoc.getIDocumentState().IsEnableSetModified(); + rDoc.getIDocumentState().SetEnableSetModified(false); pRet = IsPoolUserFormat( nId ) ? rDoc.FindCharFormatByName( rStr ) : rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( nId ); - if ( bResetMod ) - { - rDoc.getIDocumentState().ResetModified(); - rDoc.SetOle2Link( aOle2Lnk ); - } + rDoc.getIDocumentState().SetEnableSetModified(bModifiedEnabled); } if ( pRet ) |