summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2022-02-10 10:25:52 -0400
committerHenry Castro <hcastro@collabora.com>2022-02-11 12:47:16 +0100
commit35289e6ab7654e3f6267c41975b7285f3142c3ea (patch)
treeebd79bdc25db9c618de1b637eaeb174656bc64dc
parent4fd2a14c6ee68f0574766ec7ec3dca35debe9d20 (diff)
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/+/129789 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r--svx/source/svdraw/svdpntv.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 3395170406ac..05dbeb02d2a6 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -361,8 +361,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();