Skip to content

Commit

Permalink
crashtesting: assert on reimport of docx export of ooo102874-2.doc
Browse files Browse the repository at this point in the history
 #0  SdrObjList::RemoveObjectFromContainer (this=0x1d12e30, nObjectPosition=3) at core/svx/source/svdraw/svdpage.cxx:1093
 #1  0x00007ffff15da0bd in SdrObjList::SetObjectOrdNum (this=0x1d12e30, nOldObjNum=3, nNewObjNum=2) at core/svx/source/svdraw/svdpage.cxx:536
 #2  0x00007ffff14c954c in SdrObject::ensureSortedImmediatelyAfter (this=0x4f56d30, rFirst=...) at core/svx/source/svdraw/svdobj.cxx:897
 #3  0x00007fffcdc4978c in SwTextBoxHelper::DoTextBoxZOrderCorrection (pShape=0x4c3a660, pObj=0x4c3d730) at core/sw/source/core/doc/textboxhelper.cxx:1638
 #4  0x00007fffcdc4bcbc in SwTextBoxHelper::changeAnchor (pShape=0x4c3a660, pObj=0x4c3d730) at core/sw/source/core/doc/textboxhelper.cxx:1247
 #5  0x00007fffcdc4e613 in SwTextBoxHelper::synchronizeGroupTextBoxProperty
     (pFunc=0x7fffcdc4bc10 <SwTextBoxHelper::changeAnchor(SwFrameFormat*, SdrObject*)>, pFormat=0x4c3a660, pObj=0x4c3d730)
     at core/sw/source/core/doc/textboxhelper.cxx:1652
 #6  0x00007fffcdd41a89 in SwDrawContact::Changed_ (this=0x4c55400, rObj=..., eType=SdrUserCallType::ChildMoveOnly, pOldBoundRect=0x7fffffff09d8)
     at core/sw/source/core/draw/dcontact.cxx:1250
 #7  0x00007fffcdd410a7 in SwDrawContact::Changed (this=0x4c55400, rObj=..., eType=SdrUserCallType::ChildMoveOnly, rOldBoundRect=...)
     at core/sw/source/core/draw/dcontact.cxx:1005
 #8  0x00007ffff14c7356 in SdrObject::SendUserCall (this=0x4c3d730, eUserCall=SdrUserCallType::MoveOnly, rBoundRect=...) at core/svx/source/svdraw/svdobj.cxx:2827
 #9  0x00007ffff14b11d8 in SdrObjCustomShape::Move (this=0x4c3d730, rSiz=Size = {...}) at core/svx/source/svdraw/svdoashp.cxx:1499
 #10 0x00007ffff152753b in SdrObjGroup::Move (this=0x1be18e0, rSiz=Size = {...}) at core/svx/source/svdraw/svdogrp.cxx:561
 #11 0x00007fffce8c80b8 in SwViewShellImp::NotifySizeChg
     (unique_ptrI7SdrMarkSt14default_deleteIS2_EESaIS5_EE11_M_allocateEm=<error reading variable: Unhandled DWARF expression opcode 0x0>, hrowE=<error reading variable: Unhandled DWARF expression opcode 0x0>) at core/sw/source/core/view/vdraw.cxx:274
 #12 0x00007fffce032bc1 in AdjustSizeChgNotify (pRoot=0x5e1c7f0) at core/sw/source/core/layout/pagechg.cxx:851
 #13 0x00007fffce03243f in SwRootFrame::CheckViewLayout (this=0x5e1c7f0, pViewOpt=0x0, pVisArea=0x0) at core/sw/source/core/layout/pagechg.cxx:2445
 #14 0x00007fffce032eec in SwPageFrame::Cut (this=0x5f19910) at core/sw/source/core/layout/pagechg.cxx:921
 #15 0x00007fffce037d40 in SwRootFrame::RemovePage (this=0x5e1c7f0, pDelRef=0x7fffffff13c0, eResult=SwRemoveResult::Prev)
     at core/sw/source/core/layout/pagechg.cxx:1518
 #16 0x00007fffce03808e in SwRootFrame::RemoveSuperfluous (this=0x5e1c7f0) at core/sw/source/core/layout/pagechg.cxx:1557
 #17 0x00007fffcdfe8d04 in SwLayAction::InternalAction (this=0x7fffffff1a30, pRenderContext=0x5211510) at core/sw/source/core/layout/layact.cxx:694
 #18 0x00007fffcdfe7cc6 in SwLayAction::Action (this=0x7fffffff1a30, pRenderContext=0x5211510) at core/sw/source/core/layout/layact.cxx:396
 #19 0x00007fffce8d5995 in SwViewShell::CalcLayout (this=0x521c540) at core/sw/source/core/view/viewsh.cxx:1197
 #20 0x00007fffcde1233f in SwEditShell::CalcLayout (this=0x521c540) at core/sw/source/core/edit/edws.cxx:111

Change-Id: I66ffbbfc74e52eea2e24e486d52607e84ffb8fcb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178415
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <[email protected]>
(cherry picked from commit 71a9de6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178544
Tested-by: Jenkins CollaboraOffice <[email protected]>
Reviewed-by: Miklos Vajna <[email protected]>
  • Loading branch information
caolanm authored and vmiklos committed Dec 16, 2024
1 parent 1c77878 commit f1d5dcb
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions sw/source/core/view/vdraw.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ void SwViewShellImp::NotifySizeChg( const Size &rNewSz )

OSL_ENSURE( m_pShell->getIDocumentDrawModelAccess().GetDrawModel(), "NotifySizeChg without DrawModel" );
SdrPage* pPage = m_pShell->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 );
std::vector<SdrObject*> aCandidatesToMove;
for (const rtl::Reference<SdrObject>& pObj : *pPage)
{
if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj.get()) == nullptr )
Expand Down Expand Up @@ -252,27 +253,33 @@ void SwViewShellImp::NotifySizeChg( const Size &rNewSz )
continue;
}

const tools::Rectangle aObjBound( pObj->GetCurrentBoundRect() );
if ( !aDocRect.Contains( aObjBound ) )
{
Size aSz;
if ( aObjBound.Left() > aDocRect.Right() )
aSz.setWidth( (aDocRect.Right() - aObjBound.Left()) - MINFLY );
if ( aObjBound.Top() > aDocRect.Bottom() )
aSz.setHeight( (aDocRect.Bottom() - aObjBound.Top()) - MINFLY );
if ( aSz.Width() || aSz.Height() )
pObj->Move( aSz );

// Don't let large objects disappear to the top
aSz.setWidth(0);
aSz.setHeight(0);
if ( aObjBound.Right() < aDocRect.Left() )
aSz.setWidth( (aDocRect.Left() - aObjBound.Right()) + MINFLY );
if ( aObjBound.Bottom() < aDocRect.Top() )
aSz.setHeight( (aDocRect.Top() - aObjBound.Bottom()) + MINFLY );
if ( aSz.Width() || aSz.Height() )
pObj->Move( aSz );
}
aCandidatesToMove.push_back(pObj.get());
}
}

// Moving a SdrObject can invalidate their positions in SdrPage's container of objects
for (const auto pObj : aCandidatesToMove)
{
const tools::Rectangle aObjBound( pObj->GetCurrentBoundRect() );
if ( !aDocRect.Contains( aObjBound ) )
{
Size aSz;
if ( aObjBound.Left() > aDocRect.Right() )
aSz.setWidth( (aDocRect.Right() - aObjBound.Left()) - MINFLY );
if ( aObjBound.Top() > aDocRect.Bottom() )
aSz.setHeight( (aDocRect.Bottom() - aObjBound.Top()) - MINFLY );
if ( aSz.Width() || aSz.Height() )
pObj->Move( aSz );

// Don't let large objects disappear to the top
aSz.setWidth(0);
aSz.setHeight(0);
if ( aObjBound.Right() < aDocRect.Left() )
aSz.setWidth( (aDocRect.Left() - aObjBound.Right()) + MINFLY );
if ( aObjBound.Bottom() < aDocRect.Top() )
aSz.setHeight( (aDocRect.Top() - aObjBound.Bottom()) + MINFLY );
if ( aSz.Width() || aSz.Height() )
pObj->Move( aSz );
}
}
}
Expand Down

0 comments on commit f1d5dcb

Please sign in to comment.