summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2013-04-12 17:02:17 +0200
committerJan Holesovsky <kendy@suse.cz>2013-04-12 17:10:53 +0200
commit120922361a5928ea4437ffe253ce209abd7060b0 (patch)
treec3b4c4673ef8d121ea8f65cc960797a5791bbae4 /sw
parentd53dd70b15f0e3f7c8a05a93f8fcd70e1147c1f7 (diff)
i#23187: Fix crash of the document.
The mbLayoutInProgress bool was effectively unused - only set and reset, but the only place that was checking for that was in lcl_RecalcRow(), again, only to set and reset it. Worse - with the document from i#23187, the mbLayoutInProgress was set / reset on a page already disposed in SwFrm::InsertPage() which was causing the crash here. So let's get rid of all this mbLayoutInProgress, its getter and setter, and NotifyLayoutOfPageInProgress class. Valgrind, thank you that you exist, would have never found it without you! :-) Change-Id: I9a9b604f8a21bb50e21af1b20b8db76d2c0504bd
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/anchoredobject.hxx2
-rw-r--r--sw/source/core/inc/pagefrm.hxx14
-rw-r--r--sw/source/core/layout/layact.cxx142
-rw-r--r--sw/source/core/layout/pagechg.cxx4
-rw-r--r--sw/source/core/layout/tabfrm.cxx13
5 files changed, 51 insertions, 124 deletions
diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx
index 0611a23a0aa5..cc5edbfb17b0 100644
--- a/sw/inc/anchoredobject.hxx
+++ b/sw/inc/anchoredobject.hxx
@@ -107,7 +107,7 @@ class SW_DLLPUBLIC SwAnchoredObject
// detected in method <SwFlyAtCntFrm::MakeAll()> or method
// <SwAnchoredDrawObject::_MakeObjPosAnchoredAtPara()>.
// The boolean is reset to <false>, when the layout process for a
- // page frame starts - see class <NotifyLayoutOfPageInProgress>.
+ // page frame starts.
bool mbTmpConsiderWrapInfluence;
mutable SwRect maObjRectWithSpaces;
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 40c1d9b8026f..f3ea61673fce 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -72,10 +72,6 @@ class SwPageFrm: public SwFtnBossFrm
sal_Bool bInvalidWordCount :1;
sal_Bool bHasGrid :1; // Grid for Asian layout
- // #i28701# - boolean, indicating that layout of page frame
- // is in progress.
- bool mbLayoutInProgress;
-
static const sal_Int8 mnShadowPxWidth;
void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
@@ -335,16 +331,6 @@ public:
const SwRect PrtWithoutHeaderAndFooter() const;
- // #i28701#
- inline bool IsLayoutInProgress() const
- {
- return mbLayoutInProgress;
- }
- inline void SetLayoutInProgress( const bool _bLayoutInProgress )
- {
- mbLayoutInProgress = _bLayoutInProgress;
- }
-
// in case this is am empty page, this function returns the 'reference' page
const SwPageFrm& GetFormatPage() const;
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 8e189e38165c..bb469008d05e 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -498,41 +498,6 @@ SwPageFrm* SwLayAction::CheckFirstVisPage( SwPageFrm *pPage )
return pPage;
}
-// OD 2004-05-12 #i28701#
-// #i114798# - unlock position on start and end of page
-// layout process.
-class NotifyLayoutOfPageInProgress
-{
- private:
- SwPageFrm& mrPageFrm;
-
- void _UnlockPositionOfObjs()
- {
- SwSortedObjs* pObjs = mrPageFrm.GetSortedObjs();
- if ( pObjs )
- {
- sal_uInt32 i = 0;
- for ( ; i < pObjs->Count(); ++i )
- {
- SwAnchoredObject* pObj = (*pObjs)[i];
- pObj->UnlockPosition();
- }
- }
- }
- public:
- NotifyLayoutOfPageInProgress( SwPageFrm& _rPageFrm )
- : mrPageFrm( _rPageFrm )
- {
- _UnlockPositionOfObjs();
- _rPageFrm.SetLayoutInProgress( true );
- }
- ~NotifyLayoutOfPageInProgress()
- {
- mrPageFrm.SetLayoutInProgress( false );
- _UnlockPositionOfObjs();
- }
-};
-
void SwLayAction::InternalAction()
{
OSL_ENSURE( pRoot->Lower()->IsPageFrm(), ":-( No page below the root.");
@@ -629,74 +594,68 @@ void SwLayAction::InternalAction()
pRoot->DeleteEmptySct();
XCHECKPAGE;
- // #i28701# - scope for instance of class <NotifyLayoutOfPageInProgress>
+ while ( !IsInterrupt() && !IsNextCycle() &&
+ ((IS_FLYS && IS_INVAFLY) || pPage->IsInvalid()) )
{
- NotifyLayoutOfPageInProgress aLayoutOfPageInProgress( *pPage );
-
+ // #i28701#
+ SwObjectFormatter::FormatObjsAtFrm( *pPage, *pPage, this );
+ if ( !IS_FLYS )
+ {
+ // If there are no (more) Flys, the flags are superfluous.
+ pPage->ValidateFlyLayout();
+ pPage->ValidateFlyCntnt();
+ }
+ // #i28701# - change condition
while ( !IsInterrupt() && !IsNextCycle() &&
- ((IS_FLYS && IS_INVAFLY) || pPage->IsInvalid()) )
+ ( pPage->IsInvalid() ||
+ (IS_FLYS && IS_INVAFLY) ) )
{
- // #i28701#
- SwObjectFormatter::FormatObjsAtFrm( *pPage, *pPage, this );
- if ( !IS_FLYS )
+ PROTOCOL( pPage, PROT_FILE_INIT, 0, 0)
+ XCHECKPAGE;
+
+ // #i81146# new loop control
+ sal_uInt16 nLoopControlRuns_1 = 0;
+ const sal_uInt16 nLoopControlMax = 20;
+
+ while ( !IsNextCycle() && pPage->IsInvalidLayout() )
{
- // If there are no (more) Flys, the flags are superfluous.
- pPage->ValidateFlyLayout();
- pPage->ValidateFlyCntnt();
+ pPage->ValidateLayout();
+
+ if ( ++nLoopControlRuns_1 > nLoopControlMax )
+ {
+ OSL_FAIL( "LoopControl_1 in SwLayAction::InternalAction" );
+ break;
+ }
+
+ FormatLayout( pPage );
+ XCHECKPAGE;
}
// #i28701# - change condition
- while ( !IsInterrupt() && !IsNextCycle() &&
- ( pPage->IsInvalid() ||
- (IS_FLYS && IS_INVAFLY) ) )
+ if ( !IsNextCycle() &&
+ ( pPage->IsInvalidCntnt() ||
+ (IS_FLYS && IS_INVAFLY) ) )
{
- PROTOCOL( pPage, PROT_FILE_INIT, 0, 0)
- XCHECKPAGE;
-
- // #i81146# new loop control
- sal_uInt16 nLoopControlRuns_1 = 0;
- const sal_uInt16 nLoopControlMax = 20;
-
- while ( !IsNextCycle() && pPage->IsInvalidLayout() )
+ pPage->ValidateFlyInCnt();
+ pPage->ValidateCntnt();
+ // #i28701#
+ pPage->ValidateFlyLayout();
+ pPage->ValidateFlyCntnt();
+ if ( !FormatCntnt( pPage ) )
{
- pPage->ValidateLayout();
-
- if ( ++nLoopControlRuns_1 > nLoopControlMax )
- {
- OSL_FAIL( "LoopControl_1 in SwLayAction::InternalAction" );
- break;
- }
-
- FormatLayout( pPage );
XCHECKPAGE;
- }
- // #i28701# - change condition
- if ( !IsNextCycle() &&
- ( pPage->IsInvalidCntnt() ||
- (IS_FLYS && IS_INVAFLY) ) )
- {
- pPage->ValidateFlyInCnt();
- pPage->ValidateCntnt();
+ pPage->InvalidateCntnt();
+ pPage->InvalidateFlyInCnt();
// #i28701#
- pPage->ValidateFlyLayout();
- pPage->ValidateFlyCntnt();
- if ( !FormatCntnt( pPage ) )
- {
- XCHECKPAGE;
- pPage->InvalidateCntnt();
- pPage->InvalidateFlyInCnt();
- // #i28701#
- pPage->InvalidateFlyLayout();
- pPage->InvalidateFlyCntnt();
- if ( IsBrowseActionStop() )
- bInput = sal_True;
- }
+ pPage->InvalidateFlyLayout();
+ pPage->InvalidateFlyCntnt();
+ if ( IsBrowseActionStop() )
+ bInput = sal_True;
}
- if( bNoLoop )
- pLayoutAccess->GetLayouter()->LoopControl( pPage, LOOP_PAGE );
}
+ if( bNoLoop )
+ pLayoutAccess->GetLayouter()->LoopControl( pPage, LOOP_PAGE );
}
- } // end of scope for instance of class <NotifyLayoutOfPageInProgress>
-
+ }
// A previous page may be invalid again.
XCHECKPAGE;
@@ -810,9 +769,6 @@ void SwLayAction::InternalAction()
while ( pPg && ( pPg->Frm().Top() < nBottom ||
( IsIdle() && pPg == pPage ) ) )
{
- // #i26945# - follow-up of #i28701#
- NotifyLayoutOfPageInProgress aLayoutOfPageInProgress( *pPg );
-
XCHECKPAGE;
// #i81146# new loop control
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 7915bc9d0c9d..8c5429ab7743 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -201,9 +201,7 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwFrm* pSib, SwPageDesc *pPgDsc ) :
SwFtnBossFrm( pFmt, pSib ),
pSortedObjs( 0 ),
pDesc( pPgDsc ),
- nPhyPageNum( 0 ),
- // OD 2004-05-17 #i28701#
- mbLayoutInProgress( false )
+ nPhyPageNum( 0 )
{
SetDerivedVert( sal_False );
SetDerivedR2L( sal_False );
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 6643a29eaa39..12d831bc34d4 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1612,15 +1612,6 @@ static sal_Bool lcl_InnerCalcLayout( SwFrm *pFrm,
static void lcl_RecalcRow( SwRowFrm& rRow, long nBottom )
{
- // #i26945# - For correct appliance of the 'straightforward
- // object positioning process, it's needed to notify that the page frame,
- // on which the given layout frame is in, is in its layout process.
- SwPageFrm* pPageFrm = rRow.FindPageFrm();
- if ( pPageFrm && !pPageFrm->IsLayoutInProgress() )
- pPageFrm->SetLayoutInProgress( true );
- else
- pPageFrm = 0L;
-
// FME 2007-08-30 #i81146# new loop control
sal_uInt16 nLoopControlRuns_1 = 0;
sal_uInt16 nLoopControlStage_1 = 0;
@@ -1701,10 +1692,6 @@ static void lcl_RecalcRow( SwRowFrm& rRow, long nBottom )
}
break;
} while( true );
-
- // #i26945#
- if ( pPageFrm )
- pPageFrm->SetLayoutInProgress( false );
}
static void lcl_RecalcTable( SwTabFrm& rTab,