[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/qt5

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 13 17:10:16 UTC 2019


 vcl/qt5/Qt5Graphics_Controls.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit c5946dfb6fe36b558967659a85d3dce8317fd7c5
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Wed Nov 13 13:02:01 2019 +0000
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Wed Nov 13 18:09:35 2019 +0100

    tdf#123851 Qt5 handle broken ScrollBar values
    
    If the scrollbar has a mnMin == 0 and mnMax == 0 then nVisibleSize
    is set to -1?! I don't know if a negative nVisibleSize makes any
    sense, so this just handles this case without crashing LO with a
    SIGFPE in the Qt library. If min == max then the visible size is
    just zero.
    
    It's actually not clear, that this crash is the same then the bug
    report, but it fixes at least the later reproducer crash.
    
    Change-Id: Ib2dd51ddecfd24ddf2d89f746cbc8975269e13da
    Reviewed-on: https://gerrit.libreoffice.org/82600
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    Tested-by: Jenkins
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas at libreoffice.org>
    (cherry picked from commit 9bc848cf0d301aa57eabcffa101a1cf87bad6470)
    Reviewed-on: https://gerrit.libreoffice.org/82619

diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index c82bcdcc7064..7271023eaa0b 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -495,13 +495,17 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part,
             if (horizontal)
                 option.state |= QStyle::State_Horizontal;
 
-            //setup parameters from the OO values
+            // If the scrollbar has a mnMin == 0 and mnMax == 0 then mnVisibleSize is set to -1?!
+            // I don't know if a negative mnVisibleSize makes any sense, so just handle this case
+            // without crashing LO with a SIGFPE in the Qt library.
+            const long nVisibleSize = (sbVal->mnMin == sbVal->mnMax) ? 0 : sbVal->mnVisibleSize;
+
             option.minimum = sbVal->mnMin;
-            option.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
+            option.maximum = sbVal->mnMax - nVisibleSize;
             option.maximum = qMax(option.maximum, option.minimum); // bnc#619772
             option.sliderValue = sbVal->mnCur;
             option.sliderPosition = sbVal->mnCur;
-            option.pageStep = sbVal->mnVisibleSize;
+            option.pageStep = nVisibleSize;
             if (part == ControlPart::DrawBackgroundHorz)
                 option.upsideDown
                     = (QGuiApplication::isRightToLeft()


More information about the Libreoffice-commits mailing list