summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-07-18 11:59:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-07-19 11:01:39 +0200
commit416e9ecac90447581825355b772fe722d012b282 (patch)
tree13bd906bad8ac3c4097ecb281aa449d0f0f1cd00 /sc
parentdea72ef111ee8a0b1b178f8cd48757514d5ca831 (diff)
cid#1448217 Use after free
Change-Id: Icb7700c701dd8e9b23bfe29bbedf27ddd9c8f0a1 Reviewed-on: https://gerrit.libreoffice.org/75911 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/drawview.hxx2
-rw-r--r--sc/source/ui/view/drawview.cxx4
-rw-r--r--sc/source/ui/view/viewfun7.cxx6
3 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 5a79b95cc60a..46f5598705f2 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -117,7 +117,7 @@ public:
bool HasMarkedControl() const;
bool HasMarkedInternal() const;
- void InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV);
+ bool InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV);
/** Returns the selected object, if it is the caption object of a cell note.
@param ppCaptData (out-param) If not null, returns the pointer to the caption object data. */
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 273431ef0bf5..c2a4dfe58144 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -804,7 +804,7 @@ bool ScDrawView::GetObjectIsMarked( const SdrObject* pObject )
return bisMarked;
}
-void ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV)
+bool ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV)
{
SdrInsertFlags nOptions=SdrInsertFlags::NONE;
// Do not change marks when the ole object is active
@@ -817,7 +817,7 @@ void ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV)
nOptions |= SdrInsertFlags::DONTMARK;
}
- InsertObjectAtView( pObj, rPV, nOptions );
+ return InsertObjectAtView(pObj, rPV, nOptions);
}
SdrObject* ScDrawView::GetMarkedNoteCaption( ScDrawObjData** ppCaptData )
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index b128516379ff..21ccfc3848a9 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -447,15 +447,15 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
pGrafObj->SetName(aName);
// don't mark if OLE
- pScDrawView->InsertObjectSafe(pGrafObj, *pScDrawView->GetSdrPageView());
+ bool bSuccess = pScDrawView->InsertObjectSafe(pGrafObj, *pScDrawView->GetSdrPageView());
// SetGraphicLink has to be used after inserting the object,
// otherwise an empty graphic is swapped in and the contact stuff crashes.
// See #i37444#.
- if (!rFile.isEmpty())
+ if (bSuccess && !rFile.isEmpty())
pGrafObj->SetGraphicLink( rFile, ""/*TODO?*/, rFilter );
- return true;
+ return bSuccess;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */