bridges/source/cpp_uno/shared/vtablefactory.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 601d0577245e5d85211da96736609a48146c847e
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Oct 28 11:37:07 2021 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Oct 28 14:35:26 2021 +0200

    Revert broken optimization attempt
    
    This partially reverts 1a5b12aa5da2c718848d3cc5d9bce7bfcdeacf54 "optimise
    find/insert pattern", which caused
    
    > ~/llvm/inst/bin/../include/c++/v1/unordered_map:1134: _LIBCPP_ASSERT 
'__get_const_db()->__find_c_from_i(&__p) == this' failed. 
unordered_map::insert(const_iterator, const value_type&) called with an 
iterator not referring to this unordered_map
    
    during CustomTarget_testtools/uno_test in an experimental build with
    -D_LIBCPP_DEBUG=1 on macOS.
    
    Change-Id: Id40e5eab7c3fb1f8e1bb2599c7fb84649e870ba2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124319
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>
    Tested-by: Jenkins

diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx 
b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index a8aa7a9c2bfa..53b516cded5a 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -188,12 +188,11 @@ sal_Int32 VtableFactory::BaseOffset::calculate(
     typelib_InterfaceTypeDescription * type, sal_Int32 offset)
 {
     OUString name(type->aBase.pTypeName);
-    auto it = m_map.find(name);
-    if (it == m_map.end()) {
+    if (m_map.find(name) == m_map.end()) {
         for (sal_Int32 i = 0; i < type->nBaseTypes; ++i) {
             offset = calculate(type->ppBaseTypes[i], offset);
         }
-        m_map.insert(it, {name, offset});
+        m_map.insert({name, offset});
         typelib_typedescription_complete(
             reinterpret_cast< typelib_TypeDescription ** >(&type));
         offset += bridges::cpp_uno::shared::getLocalFunctions(type);

Reply via email to