From 12109f0053fefcc74e54c696a940052faffea0e3 Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Sat, 2 Sep 2017 06:19:05 +0200 Subject: tdf#109261: Crash when adding a video to a slide with zero undo steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When undo is disabled (no undo steps), ReplaceObjectAtView() method frees pPickObj, so we need to save it's reused data first. Change-Id: Icbc800d4d33cf229006aecde7d62aa2a7ea35879 Reviewed-on: https://gerrit.libreoffice.org/41822 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 27068e6cc39aed8ebfa5fdd7a67acb89f5adcb89) Reviewed-on: https://gerrit.libreoffice.org/41824 Reviewed-by: Michael Stahl --- sd/source/ui/view/sdview4.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 051a3cc0e5e3..ad806d8b6073 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -341,8 +341,12 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM else if( pPV ) { ::tools::Rectangle aRect( rPos, rSize ); + SdrObjUserCall* pUserCall = nullptr; if( pPickObj ) + { aRect = pPickObj->GetLogicRect(); + pUserCall = pPickObj->GetUserCall(); // ReplaceObjectAtView can free pPickObj + } pNewMediaObj = new SdrMediaObj( aRect ); @@ -371,9 +375,9 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM if( pPickObj ) { - pNewMediaObj->AdjustToMaxRect( pPickObj->GetLogicRect() ); + pNewMediaObj->AdjustToMaxRect( aRect ); if( bIsPres ) - pNewMediaObj->SetUserCall(pPickObj->GetUserCall()); + pNewMediaObj->SetUserCall( pUserCall ); } } -- cgit v1.2.3