From 1df43525da87c181e7c9b42967f30072951cb794 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 19 Jan 2012 17:21:31 -0500 Subject: Fix a crash when copying a sheet with drawing obj to a new document. --- sc/source/ui/view/viewfun2.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 77a26016f519..3cb218d20867 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -2466,7 +2467,7 @@ void ScViewFunc::MoveTable( sal_Bool bUndo (pDoc->IsUndoEnabled()); bool bRename = pNewTabName && !pNewTabName->isEmpty(); - sal_Bool bNewDoc = ( nDestDocNo == SC_DOC_NEW ); + bool bNewDoc = (nDestDocNo == SC_DOC_NEW); if ( bNewDoc ) { nDestTab = 0; // firstly insert @@ -2646,7 +2647,16 @@ void ScViewFunc::MoveTable( pDestDoc->DeleteTab(static_cast(TheTabs.size())); // old first table if (pDestViewSh) + { + // Make sure to clear the cached page view after sheet + // deletion, which still points to the sdr page belonging to + // the deleted sheet. + SdrView* pSdrView = pDestViewSh->GetSdrView(); + if (pSdrView) + pSdrView->ClearPageView(); + pDestViewSh->TabChanged(); // Pages auf dem Drawing-Layer + } pDestShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_SIZE ); -- cgit