svx/source/svdraw/svdpntv.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
New commits: commit 4d6d159bdfa6363eddf5cf92d67d14215053905f Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Feb 10 10:25:52 2022 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Mon Feb 14 16:50:20 2022 +0100 svx: fix dynamic cast SdrView Jan 19 13:48:41 ip-172-31-35-149 coolwsd[23647]: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/collabora/online-buildscripts/staging/builddir/libreoffice/svx/source/sdr/contact/objectcontactofpageview.cxx:353:57 in Jan 19 13:48:41 ip-172-31-35-149 coolwsd[23647]: /home/collabora/online-buildscripts/staging/builddir/libreoffice/include/svx/svdview.hxx:235:65: runtime error: member access within address 0x61c000489880 which does not point to an object of type 'SdrView' Jan 19 13:48:41 ip-172-31-35-149 coolwsd[23647]: 0x61c000489880: note: object is of type 'SdrPaintView' Jan 19 13:48:41 ip-172-31-35-149 coolwsd[23647]: 7c 04 80 3b 90 58 b9 3d 60 7f 00 00 30 51 96 0a 20 60 00 00 38 51 96 0a 20 60 00 00 38 51 96 0a Jan 19 13:48:41 ip-172-31-35-149 coolwsd[23647]: ^~~~~~~~~~~~~~~~~~~~~~~ Jan 19 13:48:41 ip-172-31-35-149 coolwsd[23647]: vptr for 'SdrPaintView'. Change-Id: Ifc9177902ac834d400d6bf9f72b94e82f544b348 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-by: Henry Castro <hcas...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129824 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index f4fa2e4783bc..d7a682272700 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -395,8 +395,11 @@ SdrPageView* SdrPaintView::ShowSdrPage(SdrPage* pPage) mpPageView.reset(); } - mpPageView.reset(new SdrPageView(pPage, *static_cast<SdrView*>(this))); - mpPageView->Show(); + if (SdrView *pView = dynamic_cast<SdrView*>(this)) + { + mpPageView.reset(new SdrPageView(pPage, *pView)); + mpPageView->Show(); + } } return mpPageView.get();