summaryrefslogtreecommitdiff
path: root/svx
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:46:26 +0100
commitde1c0ccc3766b4a9367d16a972adc04ef011a536 (patch)
tree5244bca3fb31b826cba67f1954e571535ab622a0 /svx
parent1000a4fa834c8d7b20ed235b124d9c4fe9cd2e26 (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/+/129791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'svx')
-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 5ab5b150d175..0135120e577a 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -365,8 +365,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();