Kaydet (Commit) 12092236 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

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
üst d53dd70b
...@@ -107,7 +107,7 @@ class SW_DLLPUBLIC SwAnchoredObject ...@@ -107,7 +107,7 @@ class SW_DLLPUBLIC SwAnchoredObject
// detected in method <SwFlyAtCntFrm::MakeAll()> or method // detected in method <SwFlyAtCntFrm::MakeAll()> or method
// <SwAnchoredDrawObject::_MakeObjPosAnchoredAtPara()>. // <SwAnchoredDrawObject::_MakeObjPosAnchoredAtPara()>.
// The boolean is reset to <false>, when the layout process for a // The boolean is reset to <false>, when the layout process for a
// page frame starts - see class <NotifyLayoutOfPageInProgress>. // page frame starts.
bool mbTmpConsiderWrapInfluence; bool mbTmpConsiderWrapInfluence;
mutable SwRect maObjRectWithSpaces; mutable SwRect maObjRectWithSpaces;
......
...@@ -72,10 +72,6 @@ class SwPageFrm: public SwFtnBossFrm ...@@ -72,10 +72,6 @@ class SwPageFrm: public SwFtnBossFrm
sal_Bool bInvalidWordCount :1; sal_Bool bInvalidWordCount :1;
sal_Bool bHasGrid :1; // Grid for Asian layout 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; static const sal_Int8 mnShadowPxWidth;
void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &, void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
...@@ -335,16 +331,6 @@ public: ...@@ -335,16 +331,6 @@ public:
const SwRect PrtWithoutHeaderAndFooter() const; 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 // in case this is am empty page, this function returns the 'reference' page
const SwPageFrm& GetFormatPage() const; const SwPageFrm& GetFormatPage() const;
......
...@@ -498,41 +498,6 @@ SwPageFrm* SwLayAction::CheckFirstVisPage( SwPageFrm *pPage ) ...@@ -498,41 +498,6 @@ SwPageFrm* SwLayAction::CheckFirstVisPage( SwPageFrm *pPage )
return 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() void SwLayAction::InternalAction()
{ {
OSL_ENSURE( pRoot->Lower()->IsPageFrm(), ":-( No page below the root."); OSL_ENSURE( pRoot->Lower()->IsPageFrm(), ":-( No page below the root.");
...@@ -629,10 +594,6 @@ void SwLayAction::InternalAction() ...@@ -629,10 +594,6 @@ void SwLayAction::InternalAction()
pRoot->DeleteEmptySct(); pRoot->DeleteEmptySct();
XCHECKPAGE; XCHECKPAGE;
// #i28701# - scope for instance of class <NotifyLayoutOfPageInProgress>
{
NotifyLayoutOfPageInProgress aLayoutOfPageInProgress( *pPage );
while ( !IsInterrupt() && !IsNextCycle() && while ( !IsInterrupt() && !IsNextCycle() &&
((IS_FLYS && IS_INVAFLY) || pPage->IsInvalid()) ) ((IS_FLYS && IS_INVAFLY) || pPage->IsInvalid()) )
{ {
...@@ -695,8 +656,6 @@ void SwLayAction::InternalAction() ...@@ -695,8 +656,6 @@ void SwLayAction::InternalAction()
pLayoutAccess->GetLayouter()->LoopControl( pPage, LOOP_PAGE ); pLayoutAccess->GetLayouter()->LoopControl( pPage, LOOP_PAGE );
} }
} }
} // end of scope for instance of class <NotifyLayoutOfPageInProgress>
// A previous page may be invalid again. // A previous page may be invalid again.
XCHECKPAGE; XCHECKPAGE;
...@@ -810,9 +769,6 @@ void SwLayAction::InternalAction() ...@@ -810,9 +769,6 @@ void SwLayAction::InternalAction()
while ( pPg && ( pPg->Frm().Top() < nBottom || while ( pPg && ( pPg->Frm().Top() < nBottom ||
( IsIdle() && pPg == pPage ) ) ) ( IsIdle() && pPg == pPage ) ) )
{ {
// #i26945# - follow-up of #i28701#
NotifyLayoutOfPageInProgress aLayoutOfPageInProgress( *pPg );
XCHECKPAGE; XCHECKPAGE;
// #i81146# new loop control // #i81146# new loop control
......
...@@ -201,9 +201,7 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwFrm* pSib, SwPageDesc *pPgDsc ) : ...@@ -201,9 +201,7 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwFrm* pSib, SwPageDesc *pPgDsc ) :
SwFtnBossFrm( pFmt, pSib ), SwFtnBossFrm( pFmt, pSib ),
pSortedObjs( 0 ), pSortedObjs( 0 ),
pDesc( pPgDsc ), pDesc( pPgDsc ),
nPhyPageNum( 0 ), nPhyPageNum( 0 )
// OD 2004-05-17 #i28701#
mbLayoutInProgress( false )
{ {
SetDerivedVert( sal_False ); SetDerivedVert( sal_False );
SetDerivedR2L( sal_False ); SetDerivedR2L( sal_False );
......
...@@ -1612,15 +1612,6 @@ static sal_Bool lcl_InnerCalcLayout( SwFrm *pFrm, ...@@ -1612,15 +1612,6 @@ static sal_Bool lcl_InnerCalcLayout( SwFrm *pFrm,
static void lcl_RecalcRow( SwRowFrm& rRow, long nBottom ) 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 // FME 2007-08-30 #i81146# new loop control
sal_uInt16 nLoopControlRuns_1 = 0; sal_uInt16 nLoopControlRuns_1 = 0;
sal_uInt16 nLoopControlStage_1 = 0; sal_uInt16 nLoopControlStage_1 = 0;
...@@ -1701,10 +1692,6 @@ static void lcl_RecalcRow( SwRowFrm& rRow, long nBottom ) ...@@ -1701,10 +1692,6 @@ static void lcl_RecalcRow( SwRowFrm& rRow, long nBottom )
} }
break; break;
} while( true ); } while( true );
// #i26945#
if ( pPageFrm )
pPageFrm->SetLayoutInProgress( false );
} }
static void lcl_RecalcTable( SwTabFrm& rTab, static void lcl_RecalcTable( SwTabFrm& rTab,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment