[Libreoffice-commits] core.git: 3 commits - sw/source

Michael Stahl mstahl at redhat.com
Fri Jun 9 22:11:52 UTC 2017


 sw/source/core/crsr/crsrsh.cxx         |   33 +++++++++++++++++++--------------
 sw/source/core/crsr/swcrsr.cxx         |    1 +
 sw/source/core/edit/autofmt.cxx        |    1 +
 sw/source/core/fields/postithelper.cxx |    5 ++++-
 sw/source/core/frmedt/fews.cxx         |    6 +++++-
 sw/source/core/inc/rootfrm.hxx         |   22 ++++++++++++++++++++++
 sw/source/core/layout/flylay.cxx       |    2 +-
 sw/source/core/layout/frmtool.cxx      |    2 ++
 sw/source/core/layout/trvlfrm.cxx      |   26 +++-----------------------
 sw/source/core/unocore/unotbl.cxx      |    1 +
 10 files changed, 59 insertions(+), 40 deletions(-)

New commits:
commit 2d2af57bc0406cd3afd376dd3c92be112b8c9603
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jun 9 23:48:25 2017 +0200

    sw: DisableCallbackAction in a bunch more places
    
    ... to prevent recursive layout.
    
    Change-Id: I4a7cdcebe77bd7d8d16c721765ad5eb171e84619

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 400a751768cc..97a5cb3d453f 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1541,15 +1541,18 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
 
             SwCursorMoveState aTmpState( MV_NONE );
             aTmpState.m_bRealHeight = true;
-            if( !pTableFrame->GetCharRect( m_aCharRect, *m_pTableCursor->GetPoint(), &aTmpState ) )
             {
-                Point aCentrPt( m_aCharRect.Center() );
-                aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
-                pTableFrame->GetCursorOfst( m_pTableCursor->GetPoint(), aCentrPt, &aTmpState );
-                bool const bResult =
-                    pTableFrame->GetCharRect( m_aCharRect, *m_pTableCursor->GetPoint() );
-                OSL_ENSURE( bResult, "GetCharRect failed." );
-                (void) bResult; // non-debug: unused
+                DisableCallbackAction a(*GetLayout());
+                if (!pTableFrame->GetCharRect( m_aCharRect, *m_pTableCursor->GetPoint(), &aTmpState))
+                {
+                    Point aCentrPt( m_aCharRect.Center() );
+                    aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
+                    pTableFrame->GetCursorOfst(m_pTableCursor->GetPoint(), aCentrPt, &aTmpState);
+                    bool const bResult =
+                        pTableFrame->GetCharRect(m_aCharRect, *m_pTableCursor->GetPoint());
+                    OSL_ENSURE( bResult, "GetCharRect failed." );
+                    (void) bResult; // non-debug: unused
+                }
             }
 
             m_pVisibleCursor->Hide(); // always hide visible Cursor
@@ -1804,6 +1807,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
 
         if( !(eFlags & SwCursorShell::UPDOWN ))   // delete old Pos. of Up/Down
         {
+            DisableCallbackAction a(*GetLayout());
             pFrame->Calc(GetOut());
             m_nUpDownX = pFrame->IsVertical() ?
                        m_aCharRect.Top() - pFrame->Frame().Top() :
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index de3452b4f988..23e6a6b59f61 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1843,6 +1843,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
             if( !pTableCursor )
             {
                 // try to position the cursor at half of the char-rect's height
+                DisableCallbackAction a(*GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout());
                 pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() );
                 SwCursorMoveState eTmpState( MV_UPDOWN );
                 eTmpState.m_bSetInReadOnly = bInReadOnly;
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 09bd92e16f6f..f9a992833f10 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -250,6 +250,7 @@ SwTextFrame* SwAutoFormat::GetFrame( const SwTextNode& rTextNd ) const
     OSL_ENSURE( pFrame, "For Autoformat a Layout is needed" );
     if( m_aFlags.bAFormatByInput && !pFrame->IsValid() )
     {
+        DisableCallbackAction a(const_cast<SwRootFrame&>(*pFrame->getRootFrame()));
         SwRect aTmpFrame( pFrame->Frame() );
         SwRect aTmpPrt( pFrame->Prt() );
         pFrame->Calc(pFrame->getRootFrame()->GetCurrShell()->GetOut());
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index cfe556c76e56..8da466867d28 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -60,7 +60,10 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos(
                 aRet = VISIBLE;
 
                 o_rInfo.mpAnchorFrame = pTextFrame;
-                pTextFrame->GetCharRect(o_rInfo.mPosition, rAnchorPos, nullptr, false);
+                {
+                    DisableCallbackAction a(*pTextFrame->getRootFrame());
+                    pTextFrame->GetCharRect(o_rInfo.mPosition, rAnchorPos, nullptr, false);
+                }
                 if ( pAnnotationStartPos != nullptr )
                 {
                     o_rInfo.mnStartNodeIdx = pAnnotationStartPos->nNode.GetIndex();
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index d1b2a0906454..1208a71aa8cf 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -116,9 +116,13 @@ const SwRect& SwFEShell::GetAnyCurRect( CurRectType eType, const Point* pPt,
         case CurRectType::Page :    pFrame = pFrame->FindPageFrame();
                                     break;
 
-        case CurRectType::PageCalc:pFrame->Calc(Imp()->GetShell()->GetOut());
+        case CurRectType::PageCalc:
+                                {
+                                    DisableCallbackAction a(const_cast<SwRootFrame&>(*pFrame->getRootFrame()));
+                                    pFrame->Calc(Imp()->GetShell()->GetOut());
                                     pFrame = pFrame->FindPageFrame();
                                     pFrame->Calc(Imp()->GetShell()->GetOut());
+                                }
                                     break;
 
         case CurRectType::FlyEmbeddedPrt:
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 1c00d99e4461..e35c6185c2db 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -616,6 +616,7 @@ static bool lcl_FormatTable(SwFrameFormat* pTableFormat)
         // mba: no TYPEINFO for SwTabFrame
         if(!pFrame->IsTabFrame())
             continue;
+        DisableCallbackAction a(*pFrame->getRootFrame());
         SwTabFrame* pTabFrame = static_cast<SwTabFrame*>(pFrame);
         if(pTabFrame->IsValid())
             pTabFrame->InvalidatePos();
commit d76fa3f5a5ae1d781ddd7457607a5773373d4f01
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jun 9 22:29:49 2017 +0200

    sw: use DisableCallbackAction here also
    
    This should also fix tdf#91602 and appears more consistent.
    
    Change-Id: Ic0a227d01f45b01b5cfb511d12b71b3b3aa84a05

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 64af2eea098f..400a751768cc 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1764,14 +1764,15 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
             aTmpState.m_pSpecialPos = &aSpecialPos;
         }
 
-        ++mnStartAction; // tdf#91602 prevent recursive Action!
-        if( !pFrame->GetCharRect( m_aCharRect, *pShellCursor->GetPoint(), &aTmpState ) )
         {
-            Point& rPt = pShellCursor->GetPtPos();
-            rPt = m_aCharRect.Center();
-            pFrame->GetCursorOfst( pShellCursor->GetPoint(), rPt, &aTmpState );
+            DisableCallbackAction a(*GetLayout()); // tdf#91602 prevent recursive Action
+            if (!pFrame->GetCharRect(m_aCharRect, *pShellCursor->GetPoint(), &aTmpState))
+            {
+                Point& rPt = pShellCursor->GetPtPos();
+                rPt = m_aCharRect.Center();
+                pFrame->GetCursorOfst( pShellCursor->GetPoint(), rPt, &aTmpState );
+            }
         }
-        --mnStartAction;
         UISizeNotify(); // tdf#96256 update view size
 
         if( !pShellCursor->HasMark() )
commit 2ca0360a6c75959bf61bd2ee0ef96b2729369a15
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jun 9 18:03:40 2017 +0200

    tdf#108118 sw: fix recursive layouting during SwCursorShell::Paint()
    
    The problem, in a nutshell, is that SwDrawContact::Changed() is called
    during layout, and recursively starts another layout that removes a
    drawing object that is being iterated over in frame #28
    SwObjectFormatter::FormatObjsAtFrame_() from the layout.
    
    Apparently SwDrawContact::Changed() is by far the most dangerous
    function to call during layout; set the quite targeted flag
    SetCallbackActionEnabled() to prevent the recursion.
    
    0  SwSortedObjs::Remove(SwAnchoredObject&) (this=0x73e4a00, _rAnchoredObj=...) at sw/source/core/layout/sortedobjs.cxx:228
    1  SwFrame::RemoveDrawObj(SwAnchoredObject&) (this=0x9430e20, _rToRemoveObj=...) at sw/source/core/layout/fly.cxx:2076
    2  SwDrawVirtObj::RemoveFromWriterLayout() (this=0x95ce130) at sw/source/core/draw/dcontact.cxx:2199
    3  SwDrawContact::DisconnectObjFromLayout(SdrObject*) (this=0x70fef00, _pDrawObj=0x95ce130) at sw/source/core/draw/dcontact.cxx:1663
    4  SwLayoutFrame::DestroyImpl() (this=0x91c6c60) at sw/source/core/layout/ssfrm.cxx:489
    5  SwFrame::DestroyFrame(SwFrame*) (pFrame=0x91c6c60) at sw/source/core/layout/ssfrm.cxx:389
    6  SwLayoutFrame::DestroyImpl() (this=0x9435cd0) at sw/source/core/layout/ssfrm.cxx:500
    7  SwPageFrame::DestroyImpl() (this=0x9435cd0) at sw/source/core/layout/pagechg.cxx:270
    8  SwFrame::DestroyFrame(SwFrame*) (pFrame=0x9435cd0) at sw/source/core/layout/ssfrm.cxx:389
    9  SwRootFrame::RemovePage(SwPageFrame**, SwRemoveResult) (this=0x36b26f0, pDelRef=0x7ffeafbf2e38, eResult=SwRemoveResult::Prev) at sw/source/core/layout/pagechg.cxx:1351
    10 SwRootFrame::RemoveSuperfluous() (this=0x36b26f0) at sw/source/core/layout/pagechg.cxx:1426
    11 SwLayAction::InternalAction(OutputDevice*) (this=0x7ffeafbf3250, pRenderContext=0x3595030) at sw/source/core/layout/layact.cxx:502
    12 SwLayAction::Action(OutputDevice*) (this=0x7ffeafbf3250, pRenderContext=0x3595030) at sw/source/core/layout/layact.cxx:351
    13 SwViewShell::ImplEndAction(bool) (this=0x364cc00, bIdleEnd=false) at sw/source/core/view/viewsh.cxx:279
    14 SwViewShell::EndAction(bool) (this=0x364cc00, bIdleEnd=false) at sw/inc/viewsh.hxx:605
    15 SwCursorShell::EndAction(bool, bool) (this=0x364cc00, bIdleEnd=false, DoSetPosX=false) at sw/source/core/crsr/crsrsh.cxx:259
    16 SwRootFrame::EndAllAction(bool) (this=0x36b26f0, bVirDev=false) at sw/source/core/layout/pagechg.cxx:1728
    17 SwDrawContact::Changed(SdrObject const&, SdrUserCallType, tools::Rectangle const&) (this=0x70fef00, rObj=..., eType=SdrUserCallType::MoveOnly, rOldBoundRect=...) at sw/source/core/draw/dcontact.cxx:985
    18 SdrObject::SendUserCall(SdrUserCallType, tools::Rectangle const&) const (this=0x95ce130, eUserCall=SdrUserCallType::MoveOnly, rBoundRect=...) at svx/source/svdraw/svdobj.cxx:2736
    19 SdrObject::Move(Size const&) (this=0x95ce130, rSiz=Size = {...}) at svx/source/svdraw/svdobj.cxx:1482
    20 SwDrawVirtObj::Move(Size const&) (this=0x95ce130, rSiz=Size = {...}) at sw/source/core/draw/dcontact.cxx:2366
    21 SwAnchoredDrawObject::SetObjTop_(long) (this=0x95ce250, _nTop=777490) at sw/source/core/layout/anchoreddrawobject.cxx:677
    22 SwAnchoredObject::SetObjTop(long) (this=0x95ce250, _nTop=777490) at sw/source/core/layout/anchoredobject.cxx:593
    23 objectpositioning::SwToContentAnchoredObjectPosition::CalcPosition() (this=0x7ffeafbf3980) at sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx:739
    24 SwAnchoredDrawObject::MakeObjPosAnchoredAtPara() (this=0x95ce250) at sw/source/core/layout/anchoreddrawobject.cxx:421
    25 SwAnchoredDrawObject::MakeObjPos() (this=0x95ce250) at sw/source/core/layout/anchoreddrawobject.cxx:318
    26 SwObjectFormatter::FormatObj_(SwAnchoredObject&) (this=0x90623d0, _rAnchoredObj=...) at sw/source/core/layout/objectformatter.cxx:374
    27 SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool) (this=0x90623d0, _rAnchoredObj=..., _bCheckForMovedFwd=false) at sw/source/core/layout/objectformattertxtfrm.cxx:126
    28 SwObjectFormatter::FormatObjsAtFrame_(SwTextFrame*) (this=0x90623d0, _pMasterTextFrame=0x0) at sw/source/core/layout/objectformatter.cxx:443
    29 SwObjectFormatterTextFrame::DoFormatObjs() (this=0x90623d0) at sw/source/core/layout/objectformattertxtfrm.cxx:328
    30 SwObjectFormatter::FormatObjsAtFrame(SwFrame&, SwPageFrame const&, SwLayAction*) (_rAnchorFrame=..., _rPageFrame=..., _pLayAction=0x0) at sw/source/core/layout/objectformatter.cxx:191
    31 SwHeadFootFrame::FormatSize(long, SwBorderAttrs const*) (this=0x91c6c60, nUL=663, pAttrs=0x8fbc530) at sw/source/core/layout/hffrm.cxx:263
    32 SwHeadFootFrame::Format(OutputDevice*, SwBorderAttrs const*) (this=0x91c6c60, pRenderContext=0x3595030, pAttrs=0x8fbc530) at sw/source/core/layout/hffrm.cxx:416
    33 SwLayoutFrame::MakeAll(OutputDevice*) (this=0x91c6c60) at sw/source/core/layout/calcmove.cxx:913
    34 SwFrame::PrepareMake(OutputDevice*) (this=0x91c6c60, pRenderContext=0x3595030) at sw/source/core/layout/calcmove.cxx:346
    35 SwFrame::Calc(OutputDevice*) const (this=0x91c6c60, pRenderContext=0x3595030) at sw/source/core/layout/trvlfrm.cxx:1783
    36 lcl_FormatLay(SwLayoutFrame*) (pLay=0x91c6c60) at sw/source/core/layout/pagechg.cxx:360
    37 lcl_FormatLay(SwLayoutFrame*) (pLay=0x9435cd0) at sw/source/core/layout/pagechg.cxx:357
    38 SwPageFrame::PreparePage(bool) (this=0x9435cd0, bFootnote=false) at sw/source/core/layout/pagechg.cxx:456
    39 (anonymous namespace)::doInsertPage(SwRootFrame*, SwPageFrame**, SwFrameFormat*, SwPageDesc*, bool, SwPageFrame**) (pRoot=0x36b26f0, pRefSibling=0x7ffeafbf43c8, pFormat=0x3076050, pDesc=0x3076010, bFootnote=false, pRefPage=0x7ffeafbf43d8) at sw/source/core/layout/pagechg.cxx:1210
    40 SwFrame::InsertPage(SwPageFrame*, bool) (this=0x3620d70, pPrevPage=0x9227900, bFootnote=false) at sw/source/core/layout/pagechg.cxx:1269
    41 SwFrame::GetNextLeaf(MakePageType) (this=0x3620d70, eMakePage=MAKEPAGE_INSERT) at sw/source/core/layout/flowfrm.cxx:994
    42 SwFrame::GetLeaf(MakePageType, bool) (this=0x3620d70, eMakePage=MAKEPAGE_INSERT, bFwd=true) at sw/source/core/layout/flowfrm.cxx:797
    43 SwFlowFrame::MoveFwd(bool, bool, bool) (this=0x3620e18, bMakePage=true, bPageBreak=false, bMoveAlways=false) at sw/source/core/layout/flowfrm.cxx:1851
    44 SwContentFrame::MakeAll(OutputDevice*) (this=0x3620d70) at sw/source/core/layout/calcmove.cxx:1681
    45 SwFrame::PrepareMake(OutputDevice*) (this=0x707a340, pRenderContext=0x3595030) at sw/source/core/layout/calcmove.cxx:312
    46 SwFrame::Calc(OutputDevice*) const (this=0x707a340, pRenderContext=0x3595030) at sw/source/core/layout/trvlfrm.cxx:1783
    47 GetFrameOfModify(SwRootFrame const*, SwModify const&, SwFrameType, Point const*, SwPosition const*, bool) (pLayout=0x36b26f0, rMod=..., nFrameType=(SwFrameType::Txt | SwFrameType::NoTxt), pPoint=0x707c6f0, pPos=0x707c720, bCalcFrame=true) at sw/source/core/layout/frmtool.cxx:3247
    48 SwContentNode::getLayoutFrame(SwRootFrame const*, Point const*, SwPosition const*, bool) const (this=0x71328c0, _pRoot=0x36b26f0, pPoint=0x707c6f0, pPos=0x707c720, bCalcFrame=true) at sw/source/core/docnode/node.cxx:1118
    49 SwRootFrame::CalcFrameRects(SwShellCursor&) (this=0x36b26f0, rCursor=...) at sw/source/core/layout/trvlfrm.cxx:2028
    50 SwShellCursor::FillRects() (this=0x707c680) at sw/source/core/crsr/viscrs.cxx:609
    51 SwSelPaintRects::Show(std::__debug::vector<rtl::OString, std::allocator<rtl::OString> >*) (this=0x707c680, pSelectionRectangles=0x7ffeafbf5570) at sw/source/core/crsr/viscrs.cxx:332
    52 SwShellCursor::Show(SfxViewShell*) (this=0x707c680, pViewShell=0x0) at sw/source/core/crsr/viscrs.cxx:619
    53 SwCursorShell::Paint(OutputDevice&, tools::Rectangle const&) (this=0x364cc00, rRenderContext=..., rRect=...) at sw/source/core/crsr/crsrsh.cxx:1283
    54 SwEditWin::Paint(OutputDevice&, tools::Rectangle const&) (this=0x3595030, rRenderContext=..., rRect=...) at sw/source/uibase/docvw/edtwin2.cxx:476
    
    Change-Id: I1b237f0f425e58bb95bae9f19019f26fe5da21fd

diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index 66a3e590a490..73c020e8e9a8 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -420,6 +420,28 @@ inline  void SwRootFrame::SetVirtPageNum( const bool bOf) const
     const_cast<SwRootFrame*>(this)->mbIsVirtPageNum = bOf;
 }
 
+/// helper class to disable creation of an action by a callback event
+/// in particular, change event from a drawing object (SwDrawContact::Changed())
+class DisableCallbackAction
+{
+    private:
+        SwRootFrame & m_rRootFrame;
+        bool m_bOldCallbackActionState;
+
+    public:
+        explicit DisableCallbackAction(SwRootFrame & rRootFrame)
+            : m_rRootFrame(rRootFrame)
+            , m_bOldCallbackActionState(rRootFrame.IsCallbackActionEnabled())
+        {
+            m_rRootFrame.SetCallbackActionEnabled(false);
+        }
+
+        ~DisableCallbackAction()
+        {
+            m_rRootFrame.SetCallbackActionEnabled(m_bOldCallbackActionState);
+        }
+};
+
 #endif // INCLUDED_SW_SOURCE_CORE_INC_ROOTFRM_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 47b10ca812d2..17dbc5086bac 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -800,7 +800,7 @@ void SwPageFrame::AppendDrawObjToPage( SwAnchoredObject& _rNewObj )
         static_cast<SwRootFrame*>(GetUpper())->InvalidateBrowseWidth();
     }
 
-    OSL_ENSURE( _rNewObj.GetAnchorFrame(), "anchored draw object without anchor" );
+    assert(_rNewObj.GetAnchorFrame());
     SwFlyFrame* pFlyFrame = const_cast<SwFlyFrame*>(_rNewObj.GetAnchorFrame()->FindFlyFrame());
     if ( pFlyFrame &&
          _rNewObj.GetDrawObj()->GetOrdNum() < pFlyFrame->GetVirtDrawObj()->GetOrdNum() )
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 1ebc28a52498..1fe27ac3cf6e 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3234,6 +3234,8 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF
 
                     if( bCalcFrame )
                     {
+                        // tdf#108118 prevent recursion
+                        DisableCallbackAction a(*pTmpFrame->getRootFrame());
                         // - format parent Writer
                         // fly frame, if it isn't been formatted yet.
                         // Note: The Writer fly frame could be the frame itself.
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 60e1ed637138..05864d10a4ba 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1449,28 +1449,6 @@ void SwPageFrame::GetContentPosition( const Point &rPt, SwPosition &rPos ) const
     }
 }
 
-// #123110# - helper class to disable creation of an action
-// by a callback event - e.g., change event from a drawing object
-class DisableCallbackAction
-{
-    private:
-        SwRootFrame& mrRootFrame;
-        bool mbOldCallbackActionState;
-
-    public:
-        explicit DisableCallbackAction( const SwRootFrame& _rRootFrame ) :
-            mrRootFrame( const_cast<SwRootFrame&>(_rRootFrame) ),
-            mbOldCallbackActionState( _rRootFrame.IsCallbackActionEnabled() )
-        {
-            mrRootFrame.SetCallbackActionEnabled( false );
-        }
-
-        ~DisableCallbackAction()
-        {
-            mrRootFrame.SetCallbackActionEnabled( mbOldCallbackActionState );
-        }
-};
-
 /** Search the nearest Content to the passed point.
  *
  * Only search inside the BodyText.
@@ -1483,7 +1461,7 @@ Point SwRootFrame::GetNextPrevContentPos( const Point& rPoint, bool bNext ) cons
     // #123110# - disable creation of an action by a callback
     // event during processing of this method. Needed because formatting is
     // triggered by this method.
-    DisableCallbackAction aDisableCallbackAction( *this );
+    DisableCallbackAction aDisableCallbackAction(const_cast<SwRootFrame&>(*this));
     //Search the first ContentFrame and his successor in the body area.
     //To be efficient (and not formatting too much) we'll start at the correct
     //page.
@@ -2019,6 +1997,8 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
         return;
     }
 
+    DisableCallbackAction a(*this); // the GetCharRect below may format
+
     //First obtain the ContentFrames for the start and the end - those are needed
     //anyway.
     SwContentFrame const* pStartFrame = pStartPos->nNode.GetNode().


More information about the Libreoffice-commits mailing list