sc/source/core/data/colorscale.cxx   |    6 ++++--
 toolkit/source/helper/unowrapper.cxx |    6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 45d400ec42a59b03aca00cf1e08e3a9be2488537
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Thu Jun 2 15:51:47 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Jun 15 06:56:08 2022 +0200

    Fix leak with stock widgets in a dialog from an extension
    
    When loading a dialog from XDL, buttons can have dlg:button-type="cancel"
    or dlg:button-type="help". These buttons might not have a peer when
    they are not referenced from the extension.
    
    In this case, they also weren't disposed when the dialog was disposed,
    leading to an abort on exit.
    
    Change-Id: I799d7535b766984fde47cafbe41ee6e89e476205
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135266
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
    (cherry picked from commit 4879f99b824036b3d409ed52f74dc3eb3b4949e4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135745
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/toolkit/source/helper/unowrapper.cxx 
b/toolkit/source/helper/unowrapper.cxx
index 5d5ce94a9b8f..79d2ee1e2eed 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -240,6 +240,12 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
             css::uno::Reference< css::lang::XComponent > xComp = 
pClient->GetComponentInterface( false );
             xComp->dispose();
         }
+        else
+        {
+            // We need it to dispose the child windows properly (even without 
window peer),
+            // otherwise the vcl::Window will be leaked.
+            pClient.disposeAndClear();
+        }
 
         pChild = pNextChild;
     }
commit d26e960fb3cb6dcff887654b3ec51e5cdea5a878
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Jun 14 12:24:41 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Jun 15 06:55:57 2022 +0200

    crashtesting: negative index seen on loading forum-de3-15472.ods
    
    Change-Id: I737e6132f117a85c4d7e5df4a33561d09eff86af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135837
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 47df286921e6..81944e4dd0c3 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -540,8 +540,10 @@ Color CalcColor( double nVal, double nVal1, const Color& 
rCol1, double nVal2, co
 double GetPercentile( const std::vector<double>& rArray, double fPercentile )
 {
     size_t nSize = rArray.size();
-    size_t nIndex = static_cast<size_t>(::rtl::math::approxFloor( fPercentile 
* (nSize-1)));
-    double fDiff = fPercentile * (nSize-1) - ::rtl::math::approxFloor( 
fPercentile * (nSize-1));
+    double fFloor = ::rtl::math::approxFloor(fPercentile * (nSize-1));
+    SAL_WARN_IF(fFloor < 0, "sc", "negative percentile");
+    size_t nIndex = fFloor >= 0 ? static_cast<size_t>(fFloor) : 0;
+    double fDiff = fPercentile * (nSize-1) - fFloor;
     std::vector<double>::const_iterator iter = rArray.begin() + nIndex;
     if (fDiff == 0.0)
         return *iter;

Reply via email to