[Libreoffice-commits] core.git: vcl/source
Stephan Bergmann
sbergman at redhat.com
Wed Apr 4 08:18:17 UTC 2018
vcl/source/window/printdlg.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 97164f87696ab703c03e530d4071a55381d51cc1
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Apr 4 08:58:22 2018 +0200
Avoid -fsanitize=float-divide-by-zero
...after d51bc7b3813ccbdf41a50664d41b2fa3d25c6954 "PrintPreviewWindow dynamic
preview Bitmap", in CppunitTest_vcl_dialogs_test:
> vcl/source/window/printdlg.cxx:334:32: runtime error: division by zero
> #0 in vcl::PrintDialog::PrintPreviewWindow::preparePreviewBitmap() at vcl/source/window/printdlg.cxx:334:32 (instdir/program/libvcllo.so +0x31ac6df)
> #1 in vcl::PrintDialog::PrintPreviewWindow::Resize() at vcl/source/window/printdlg.cxx:144:5 (instdir/program/libvcllo.so +0x31ab3ae)
> #2 in vcl::Window::ImplCallResize() at vcl/source/window/event.cxx:522:5 (instdir/program/libvcllo.so +0x2f546d1)
> #3 in vcl::Window::ImplPosSizeWindow(long, long, long, long, PosSizeFlags) at vcl/source/window/window.cxx:1603:17 (instdir/program/libvcllo.so +0x34f2efc)
> #4 in vcl::Window::setPosSizePixel(long, long, long, long, PosSizeFlags) at vcl/source/window/window.cxx:2831:18 (instdir/program/libvcllo.so +0x3524ca5)
> #5 in vcl::Window::SetPosSizePixel(Point const&, Size const&) at vcl/source/window/window2.cxx:1313:5 (instdir/program/libvcllo.so +0x348582b)
> #6 in VclContainer::setLayoutPosSize(vcl::Window&, Point const&, Size const&) at vcl/source/window/layout.cxx:57:13 (instdir/program/libvcllo.so +0x2f950fb)
> #7 in VclContainer::setLayoutAllocation(vcl::Window&, Point const&, Size const&) at vcl/source/window/layout.cxx:68:9 (instdir/program/libvcllo.so +0x2f953e8)
> #8 in VclBox::setAllocation(Size const&) at vcl/source/window/layout.cxx:486:13 (instdir/program/libvcllo.so +0x2f9ed9c)
> #9 in VclContainer::SetPosSizePixel(Point const&, Size const&) at vcl/source/window/layout.cxx:147:9 (instdir/program/libvcllo.so +0x2f96795)
> #10 in VclContainer::setLayoutPosSize(vcl::Window&, Point const&, Size const&) at vcl/source/window/layout.cxx:57:13 (instdir/program/libvcllo.so +0x2f950fb)
> #11 in VclContainer::setLayoutAllocation(vcl::Window&, Point const&, Size const&) at vcl/source/window/layout.cxx:68:9 (instdir/program/libvcllo.so +0x2f953e8)
> #12 in VclBox::setAllocation(Size const&) at vcl/source/window/layout.cxx:486:13 (instdir/program/libvcllo.so +0x2f9ed9c)
> #13 in VclContainer::SetPosSizePixel(Point const&, Size const&) at vcl/source/window/layout.cxx:147:9 (instdir/program/libvcllo.so +0x2f96795)
> #14 in VclContainer::setLayoutPosSize(vcl::Window&, Point const&, Size const&) at vcl/source/window/layout.cxx:57:13 (instdir/program/libvcllo.so +0x2f950fb)
> #15 in VclContainer::setLayoutAllocation(vcl::Window&, Point const&, Size const&) at vcl/source/window/layout.cxx:68:9 (instdir/program/libvcllo.so +0x2f953e8)
> #16 in VclBox::setAllocation(Size const&) at vcl/source/window/layout.cxx:486:13 (instdir/program/libvcllo.so +0x2f9ed9c)
> #17 in VclContainer::SetPosSizePixel(Point const&, Size const&) at vcl/source/window/layout.cxx:147:9 (instdir/program/libvcllo.so +0x2f96795)
> #18 in VclContainer::setLayoutPosSize(vcl::Window&, Point const&, Size const&) at vcl/source/window/layout.cxx:57:13 (instdir/program/libvcllo.so +0x2f950fb)
> #19 in VclContainer::setLayoutAllocation(vcl::Window&, Point const&, Size const&) at vcl/source/window/layout.cxx:68:9 (instdir/program/libvcllo.so +0x2f953e8)
> #20 in SystemWindow::setPosSizeOnContainee(Size, vcl::Window&) at vcl/source/window/syswin.cxx:1083:5 (instdir/program/libvcllo.so +0x3345d47)
> #21 in SystemWindow::setOptimalLayoutSize() at vcl/source/window/syswin.cxx:1133:5 (instdir/program/libvcllo.so +0x3346d69)
> #22 in SystemWindow::DoInitialLayout() at vcl/source/window/syswin.cxx:1145:9 (instdir/program/libvcllo.so +0x3347183)
> #23 in Dialog::StateChanged(StateChangedType) at vcl/source/window/dialog.cxx:724:9 (instdir/program/libvcllo.so +0x2e49078)
> #24 in vcl::Window::CompatStateChanged(StateChangedType) at vcl/source/window/window.cxx:3795:5 (instdir/program/libvcllo.so +0x3507fa6)
> #25 in vcl::Window::ImplCallInitShow() at vcl/source/window/event.cxx:484:5 (instdir/program/libvcllo.so +0x2f53367)
> #26 in vcl::Window::Show(bool, ShowFlags) at vcl/source/window/window.cxx:2294:13 (instdir/program/libvcllo.so +0x34fdeb9)
> #27 in Dialog::createScreenshot() at vcl/source/window/dialog.cxx:973:5 (instdir/program/libvcllo.so +0x2e5239c)
> #28 in ScreenshotTest::saveScreenshot(Dialog&) at test/source/screenshot_test.cxx:107:38 (workdir/LinkTarget/CppunitTest/../Library/libtest.so +0x11665a)
> #29 in ScreenshotTest::dumpDialogToPath(Dialog&) at test/source/screenshot_test.cxx:176:9 (workdir/LinkTarget/CppunitTest/../Library/libtest.so +0x117e0c)
> #30 in ScreenshotTest::dumpDialogToPath(rtl::OString const&) at test/source/screenshot_test.cxx:206:13 (workdir/LinkTarget/CppunitTest/../Library/libtest.so +0x118b34)
> #31 in ScreenshotTest::processDialogBatchFile(rtl::OUString const&) at test/source/screenshot_test.cxx:264:17 (workdir/LinkTarget/CppunitTest/../Library/libtest.so +0x119d8d)
> #32 in VclDialogsTest::openAnyDialog() at vcl/qa/unit/vcl-dialogs-test.cxx:59:5 (workdir/LinkTarget/CppunitTest/libtest_vcl_dialogs_test.so +0xf74b)
...
Change-Id: Ife158d466b012b44af1abf2b72eadd0ac4be3b7e
Reviewed-on: https://gerrit.libreoffice.org/52357
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index d7124a15fc3b..23da5dd941d5 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -331,7 +331,7 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap()
const double fPreviewSizeSquare(static_cast<double>(maPreviewBitmap.GetSizePixel().getWidth() * maPreviewBitmap.GetSizePixel().getHeight()));
// test as equal up to 0.1% (0.001)
- if(fabs((fScaledSizeSquare / fPreviewSizeSquare) - 1.0) < 0.001)
+ if(fPreviewSizeSquare == 0.0 || fabs((fScaledSizeSquare / fPreviewSizeSquare) - 1.0) < 0.001)
{
// maximum is reached, avoid bigger scaling
return;
More information about the Libreoffice-commits
mailing list