[Libreoffice-commits] core.git: 2 commits - cui/source sw/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 5 18:31:10 UTC 2021


 cui/source/dialogs/AdditionsDialog.cxx |    4 +++-
 sw/source/uibase/utlui/navipi.cxx      |    2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 6b99873a209f85a3322a318d45546d573a0a024e
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Mar 5 13:52:50 2021 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Mar 5 19:30:33 2021 +0100

    Avoid float-cast-overflow
    
    ...during UITest_sw_options
    UITEST_TEST_NAME=optionsDialog.optionsDialog.test_moreIconsDialog,
    
    > /cui/source/dialogs/AdditionsDialog.cxx:641:17: runtime error: nan is outside the range of representable values of type 'int'
    >     #0 0x2b73f252fab6 in AdditionsItem::AdditionsItem(weld::Widget*, AdditionsDialog*, AdditionInfo const&) /cui/source/dialogs/AdditionsDialog.cxx:641:17
    >     #1 0x2b73f2562963 in void __gnu_cxx::new_allocator<AdditionsItem>::construct<AdditionsItem, weld::Container*, AdditionsDialog*&, AdditionInfo&>(AdditionsItem*, weld::Container*&&, AdditionsDialog*&, AdditionInfo&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/ext/new_allocator.h:136:23
    >     #2 0x2b73f25618f8 in void std::allocator_traits<std::allocator<AdditionsItem> >::construct<AdditionsItem, weld::Container*, AdditionsDialog*&, AdditionInfo&>(std::allocator<AdditionsItem>&, AdditionsItem*, weld::Container*&&, AdditionsDialog*&, AdditionInfo&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/alloc_traits.h:475:8
    >     #3 0x2b73f2560ea0 in std::_Sp_counted_ptr_inplace<AdditionsItem, std::allocator<AdditionsItem>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<weld::Container*, AdditionsDialog*&, AdditionInfo&>(std::allocator<AdditionsItem>, weld::Container*&&, AdditionsDialog*&, AdditionInfo&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/shared_ptr_base.h:526:4
    >     #4 0x2b73f2560222 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<AdditionsItem, std::allocator<AdditionsItem>, weld::Container*, AdditionsDialog*&, AdditionInfo&>(std::_Sp_make_shared_tag, AdditionsItem*, std::allocator<AdditionsItem> const&, weld::Container*&&, AdditionsDialog*&, AdditionInfo&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/shared_ptr_base.h:637:18
    >     #5 0x2b73f255fc3d in std::__shared_ptr<AdditionsItem, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<AdditionsItem>, weld::Container*, AdditionsDialog*&, AdditionInfo&>(std::_Sp_make_shared_tag, std::allocator<AdditionsItem> const&, weld::Container*&&, AdditionsDialog*&, AdditionInfo&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/shared_ptr_base.h:1294:14
    >     #6 0x2b73f255f9bb in std::shared_ptr<AdditionsItem>::shared_ptr<std::allocator<AdditionsItem>, weld::Container*, AdditionsDialog*&, AdditionInfo&>(std::_Sp_make_shared_tag, std::allocator<AdditionsItem> const&, weld::Container*&&, AdditionsDialog*&, AdditionInfo&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/shared_ptr.h:344:4
    >     #7 0x2b73f255f5b7 in std::shared_ptr<AdditionsItem> std::allocate_shared<AdditionsItem, std::allocator<AdditionsItem>, weld::Container*, AdditionsDialog*&, AdditionInfo&>(std::allocator<AdditionsItem> const&, weld::Container*&&, AdditionsDialog*&, AdditionInfo&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/shared_ptr.h:690:14
    >     #8 0x2b73f253e5b1 in std::shared_ptr<AdditionsItem> std::make_shared<AdditionsItem, weld::Container*, AdditionsDialog*&, AdditionInfo&>(weld::Container*&&, AdditionsDialog*&, AdditionInfo&) /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/shared_ptr.h:706:14
    >     #9 0x2b73f2510e97 in SearchAndParseThread::Append(AdditionInfo&) /cui/source/dialogs/AdditionsDialog.cxx:317:20
    >     #10 0x2b73f2517167 in SearchAndParseThread::Search() /cui/source/dialogs/AdditionsDialog.cxx:357:17
    >     #11 0x2b73f251c5fe in SearchAndParseThread::execute() /cui/source/dialogs/AdditionsDialog.cxx:426:9
    >     #12 0x2b6ecdd21dd7 in salhelper::Thread::run() /salhelper/source/thread.cxx:40:9
    >     #13 0x2b6ecdd2401f in threadFunc /include/osl/thread.hxx:189:15
    >     #14 0x2b6ebabcdda8 in osl_thread_start_Impl(void*) /sal/osl/unx/thread.cxx:264:9
    >     #15 0x2b6ebca70ea4 in start_thread (/lib64/libpthread.so.0+0x7ea4)
    >     #16 0x2b6ebd3a696c in clone (/lib64/libc.so.6+0xfe96c)
    
    (<https://ci.libreoffice.org/job/lo_ubsan/1939/>) in code introduced with
    48a796c5bbdf897228eb4125512e4f80527f4b55 "tdf#133026: Additions: Rating image
    implementation", when additionInfo.sName is "Colibre Icon Theme Legacy" and
    additionInfo.sRating is "NaN".  (All those additionInfo strings are apparently
    obtained from remote JSON data in parseResponse,
    cui/source/dialogs/AdditionsDialog.cxx.)
    
    Change-Id: I073990870c432591ee66fe5ec9580e46ea7e716a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112017
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index 4ea381e385db..c41e6c262d0e 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -10,6 +10,8 @@
 
 #include <sal/config.h>
 
+#include <algorithm>
+#include <cmath>
 #include <string_view>
 
 #include <config_folders.h>
@@ -638,7 +640,7 @@ AdditionsItem::AdditionsItem(weld::Widget* pParent, AdditionsDialog* pParentDial
     m_xLabelName->set_label(sExtensionName);
 
     double aExtensionRating = additionInfo.sRating.toDouble();
-    switch (int(aExtensionRating))
+    switch (std::isnan(aExtensionRating) ? 0 : int(std::clamp(aExtensionRating, 0.0, 5.0)))
     {
         case 5:
             m_xImageVoting5->set_from_icon_name("cmd/sc_stars-full.png");
commit 2a772fcef57f55a2ad9b2085eec5b068902f331b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 5 12:28:27 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 5 19:30:16 2021 +0100

    drop SetUpdateMode on entering global mode
    
    we don't bother do this on exiting global mode. If it still makes
    sense to do this is presumably should be on child treeview-based
    widget instead
    
    Change-Id: Ic97d595e638ea0671c6efe0a47336b266cc7b83c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112014
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 1eace5034153..7e0883f03c26 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -1018,7 +1018,6 @@ void SwNavigationPI::ToggleTree()
     bool bGlobalDoc = IsGlobalDoc();
     if (!IsGlobalMode() && bGlobalDoc)
     {
-        SetUpdateMode(false);
         if (IsZoomedIn())
             ZoomOut();
         m_xGlobalBox->show();
@@ -1034,7 +1033,6 @@ void SwNavigationPI::ToggleTree()
         m_xContent6ToolBox->hide();
         m_xDocListBox->hide();
         SetGlobalMode(true);
-        SetUpdateMode(true);
     }
     else
     {


More information about the Libreoffice-commits mailing list