diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-01-10 08:49:29 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-01-10 11:31:42 +0100 |
commit | fd9a47981bf8c139a6c6ca962f3b520387019ef3 (patch) | |
tree | 0ba40c95bd5395576acde40f9533c9da6df0072f /vcl/source/app | |
parent | bf883027ee62ece0844730572305094f53daa521 (diff) |
Revert "Use clear() instead of remove_if"
This reverts commit 8accfa30343195b5d7cfd111301677a6a9b6a21b.
Reason for revert: causes asan failure:
=================================================================
==18688==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e00041a3d0 at pc 0x2b01131ad126 bp 0x7fff818edb50 sp 0x7fff818edb48
READ of size 8 at 0x60e00041a3d0 thread T0
#0 0x2b01131ad125 in SalBitmap::DropScaledCache()::$_0::operator()(std::pair<ScaleCacheKey, BitmapEx> const&) const /vcl/source/app/salvtables.cxx:154:40
#1 0x2b0113043742 in void o3tl::lru_map<ScaleCacheKey, BitmapEx, std::hash<ScaleCacheKey>, std::equal_to<ScaleCacheKey> >::remove_if<SalBitmap::DropScaledCache()::$_0>(SalBitmap::DropScaledCache()::$_0) /include/o3tl/lru_map.hxx:156:17
#2 0x2b01130432e5 in SalBitmap::DropScaledCache() /vcl/source/app/salvtables.cxx:153:16
#3 0x2b0113043d38 in SalBitmap::~SalBitmap() /vcl/source/app/salvtables.cxx:159:27
#4 0x2b01145628bc in SvpSalBitmap::~SvpSalBitmap() /vcl/headless/svpbmp.cxx:44:1
#5 0x2b0114593be3 in void __gnu_cxx::new_allocator<SvpSalBitmap>::destroy<SvpSalBitmap>(SvpSalBitmap*) /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:140:28
#6 0x2b01145939d9 in void std::allocator_traits<std::allocator<SvpSalBitmap> >::destroy<SvpSalBitmap>(std::allocator<SvpSalBitmap>&, SvpSalBitmap*) /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:487:8
#7 0x2b0114593184 in std::_Sp_counted_ptr_inplace<SvpSalBitmap, std::allocator<SvpSalBitmap>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /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:535:2
#8 0x2b010fb8cba6 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /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:154:6
#9 0x2b010fb8c9d7 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /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:684:11
#10 0x2b01117831dd in std::__shared_ptr<SalBitmap, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /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:1123:31
#11 0x2b0111782267 in std::shared_ptr<SalBitmap>::~shared_ptr() /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:93:11
#12 0x2b0112b4f51e in Bitmap::~Bitmap() /vcl/source/bitmap/bitmap.cxx:166:1
#13 0x2b010faac276 in BitmapEx::~BitmapEx() /include/vcl/bitmapex.hxx:37:37
#14 0x2b0112dbb6bd in std::pair<ScaleCacheKey, BitmapEx>::~pair() /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/stl_pair.h:198:12
#15 0x2b0112de2cfd in void __gnu_cxx::new_allocator<std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> > >::destroy<std::pair<ScaleCacheKey, BitmapEx> >(std::pair<ScaleCacheKey, BitmapEx>*) /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:140:28
#16 0x2b0112de2ba9 in void std::allocator_traits<std::allocator<std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> > > >::destroy<std::pair<ScaleCacheKey, BitmapEx> >(std::allocator<std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> > >&, std::pair<ScaleCacheKey, BitmapEx>*) /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:487:8
#17 0x2b01135146cc in std::__cxx1998::__cxx11::_List_base<std::pair<ScaleCacheKey, BitmapEx>, std::allocator<std::pair<ScaleCacheKey, BitmapEx> > >::_M_clear() /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/list.tcc:76:4
#18 0x2b01135471ce in std::__cxx1998::__cxx11::list<std::pair<ScaleCacheKey, BitmapEx>, std::allocator<std::pair<ScaleCacheKey, BitmapEx> > >::clear() /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/stl_list.h:1406:9
#19 0x2b01135470f4 in std::__debug::list<std::pair<ScaleCacheKey, BitmapEx>, std::allocator<std::pair<ScaleCacheKey, BitmapEx> > >::clear() /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/debug/list:539:9
#20 0x2b0113541f69 in o3tl::lru_map<ScaleCacheKey, BitmapEx, std::hash<ScaleCacheKey>, std::equal_to<ScaleCacheKey> >::clear() /include/o3tl/lru_map.hxx:179:18
#21 0x2b011353ce61 in DeInitVCL() /vcl/source/app/svmain.cxx:586:37
#22 0x2b0108fea6c3 in (anonymous namespace)::Protector::~Protector() /test/source/vclbootstrapprotector.cxx:32:13
#23 0x2b0108fea7b4 in (anonymous namespace)::Protector::~Protector() /test/source/vclbootstrapprotector.cxx:28:35
#24 0x2b00ed90d6ae in CppUnit::ProtectorChain::pop() /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:56:3
#25 0x2b00ed9ae022 in CppUnit::TestResult::popProtector() /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:196:21
#26 0x4ffaea in (anonymous namespace)::ProtectedFixtureFunctor::run() const /sal/cppunittester/cppunittester.cxx:338:20
#27 0x4fbbc5 in main2() /sal/cppunittester/cppunittester.cxx:478:16
#28 0x4fa052 in sal_main() /sal/cppunittester/cppunittester.cxx:614:14
#29 0x4f9e9e in main /sal/cppunittester/cppunittester.cxx:609:1
#30 0x2b00ef76f554 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:266
#31 0x425894 in _start (/workdir/LinkTarget/Executable/cppunittester+0x425894)
0x60e00041a3d0 is located 16 bytes inside of 152-byte region [0x60e00041a3c0,0x60e00041a458)
freed by thread T0 here:
#0 0x4f7080 in operator delete(void*) /home/tdf/lode/packages/llvm-llvmorg-9.0.1.src/compiler-rt/lib/asan/asan_new_delete.cc:160
#1 0x2b0112dd4714 in __gnu_cxx::new_allocator<std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> > >::deallocate(std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> >*, unsigned long) /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:125:2
#2 0x2b0112dd46c1 in std::allocator_traits<std::allocator<std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> > > >::deallocate(std::allocator<std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> > >&, std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> >*, unsigned long) /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:462:13
#3 0x2b0112de2c5d in std::__cxx1998::__cxx11::_List_base<std::pair<ScaleCacheKey, BitmapEx>, std::allocator<std::pair<ScaleCacheKey, BitmapEx> > >::_M_put_node(std::__cxx1998::_List_node<std::pair<ScaleCacheKey, BitmapEx> >*) /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/stl_list.h:387:9
#4 0x2b01135146de in std::__cxx1998::__cxx11::_List_base<std::pair<ScaleCacheKey, BitmapEx>, std::allocator<std::pair<ScaleCacheKey, BitmapEx> > >::_M_clear() /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/list.tcc:80:4
#5 0x2b01135471ce in std::__cxx1998::__cxx11::list<std::pair<ScaleCacheKey, BitmapEx>, std::allocator<std::pair<ScaleCacheKey, BitmapEx> > >::clear() /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/stl_list.h:1406:9
#6 0x2b01135470f4 in std::__debug::list<std::pair<ScaleCacheKey, BitmapEx>, std::allocator<std::pair<ScaleCacheKey, BitmapEx> > >::clear() /home/tdf/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/debug/list:539:9
#7 0x2b0113541f69 in o3tl::lru_map<ScaleCacheKey, BitmapEx, std::hash<ScaleCacheKey>, std::equal_to<ScaleCacheKey> >::clear() /include/o3tl/lru_map.hxx:179:18
#8 0x2b011353ce61 in DeInitVCL() /vcl/source/app/svmain.cxx:586:37
#9 0x2b0108fea6c3 in (anonymous namespace)::Protector::~Protector() /test/source/vclbootstrapprotector.cxx:32:13
#10 0x2b0108fea7b4 in (anonymous namespace)::Protector::~Protector() /test/source/vclbootstrapprotector.cxx:28:35
#11 0x2b00ed90d6ae in CppUnit::ProtectorChain::pop() /workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:56:3
#12 0x2b00ed9ae022 in CppUnit::TestResult::popProtector() /workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:196:21
#13 0x4ffaea in (anonymous namespace)::ProtectedFixtureFunctor::run() const /sal/cppunittester/cppunittester.cxx:338:20
#14 0x4fbbc5 in main2() /sal/cppunittester/cppunittester.cxx:478:16
#15 0x4fa052 in sal_main() /sal/cppunittester/cppunittester.cxx:614:14
#16 0x4f9e9e in main /sal/cppunittester/cppunittester.cxx:609:1
#17 0x2b00ef76f554 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:266
Change-Id: Ief4b3e60a8846121a828f1c933cc3c7dc3fe0369
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128150
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source/app')
-rw-r--r-- | vcl/source/app/svmain.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 389a84777a2a..ccbe0b177636 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -583,7 +583,10 @@ void DeInitVCL() pSVData->maGDIData.mxScreenFontList.reset(); pSVData->maGDIData.mxScreenFontCache.reset(); - pSVData->maGDIData.maScaleCache.clear(); + // we are iterating over a map and doing erase while inside a loop which is doing erase + // hence we can't use clear() here + pSVData->maGDIData.maScaleCache.remove_if([](const lru_scale_cache::key_value_pair_t&) + { return true; }); pSVData->maGDIData.maThemeDrawCommandsCache.clear(); pSVData->maGDIData.maThemeImageCache.clear(); |