[Libreoffice-commits] core.git: include/o3tl
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 4 16:15:37 UTC 2021
include/o3tl/cow_wrapper.hxx | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
New commits:
commit 2f343f09b4adaed1fe7286dfc8ba73bdb13eeabf
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Aug 4 15:58:34 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 4 18:15:00 2021 +0200
tsan:datarace in o3tl::ThreadSafeRefCountingPolicy
Because we a non-atomic read of the reference count.
Which we shouldn't be doing anyway, or the ref-counting is broken.
WARNING: ThreadSanitizer: data race (pid=121172)
Read of size 4 at 0x7b100027ba38 by thread T5:
/media/disk2/libo-san/include/o3tl/cow_wrapper.hxx:54:17
(libvcllo.so+0x7ee40d)
o3tl::ThreadSafeRefCountingPolicy>::release()
/media/disk2/libo-san/include/o3tl/cow_wrapper.hxx:208:29
(libvcllo.so+0x7ee40d)
o3tl::ThreadSafeRefCountingPolicy>::~cow_wrapper()
/media/disk2/libo-san/include/o3tl/cow_wrapper.hxx:260:13
(libvcllo.so+0x7ee40d)
/media/disk2/libo-san/vcl/source/gdi/mapmod.cxx:97:19
(libvcllo.so+0x7ee40d)
/media/disk2/libo-san/vcl/source/bitmap/bitmap.cxx:166:1
(libvcllo.so+0x92b175)
/media/disk2/libo-san/vcl/source/bitmap/alpha.cxx:49:23
(libvcllo.so+0x946475)
GraphicFilterImportFlags, vcl::ScopedBitmapAccess<BitmapWriteAccess,
Bitmap, &(Bitmap::AcquireWriteAccess())>*,
vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask,
&(AlphaMask::AcquireAlphaWriteAccess())>*)
/media/disk2/libo-san/vcl/source/filter/png/PngImageReader.cxx:383:1
(libvcllo.so+0xb67860)
vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap,
&(Bitmap::AcquireWriteAccess())>*,
vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask,
&(AlphaMask::AcquireAlphaWriteAccess())>*)
/media/disk2/libo-san/vcl/source/filter/png/PngImageReader.cxx:479:9
(libvcllo.so+0xb69139)
namespace)::GraphicImportContext&)
/media/disk2/libo-san/vcl/source/filter/graphicfilter.cxx:586:14
(libvcllo.so+0xac3a2f)
/media/disk2/libo-san/vcl/source/filter/graphicfilter.cxx:574:5
(libvcllo.so+0xac3a2f)
/media/disk2/libo-san/comphelper/source/misc/threadpool.cxx:314:9
(libcomphelper.so+0x1480ff)
/media/disk2/libo-san/comphelper/source/misc/threadpool.cxx:83:24
(libcomphelper.so+0x1480ff)
/media/disk2/libo-san/salhelper/source/thread.cxx:40:9
(libuno_salhelpergcc3.so.3+0x5350)
/media/disk2/libo-san/salhelper/source/thread.cxx
(libuno_salhelpergcc3.so.3+0x53b9)
(libuno_salhelpergcc3.so.3+0x565e)
/media/disk2/libo-san/sal/osl/unx/thread.cxx:264:9
(libuno_sal.so.3+0x68325)
Previous atomic write of size 4 at 0x7b100027ba38 by main thread
(mutexes: write M7453640868405680):
/media/disk2/libo-san/include/o3tl/cow_wrapper.hxx:57:24
(libvcllo.so+0x7eebc9)
o3tl::ThreadSafeRefCountingPolicy>::release()
/media/disk2/libo-san/include/o3tl/cow_wrapper.hxx:208:29
(libvcllo.so+0x7eebc9)
o3tl::ThreadSafeRefCountingPolicy>::operator=(o3tl::cow_wrapper<MapMode::ImplMapMode,
o3tl::ThreadSafeRefCountingPolicy> const&)
/media/disk2/libo-san/include/o3tl/cow_wrapper.hxx:269:13
(libvcllo.so+0x7eebc9)
/media/disk2/libo-san/vcl/source/gdi/mapmod.cxx:124:45
(libvcllo.so+0x7eebc9)
Change-Id: I6334b748b91bf414168c05d90fc5bd6d7dfe3dda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120005
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/o3tl/cow_wrapper.hxx b/include/o3tl/cow_wrapper.hxx
index 8cc3651030fd..c05d28699259 100644
--- a/include/o3tl/cow_wrapper.hxx
+++ b/include/o3tl/cow_wrapper.hxx
@@ -51,10 +51,7 @@ namespace o3tl
static void incrementCount( ref_count_t& rCount ) { osl_atomic_increment(&rCount); }
static bool decrementCount( ref_count_t& rCount )
{
- if( rCount == 1 ) // caller is already the only/last reference
- return false;
- else
- return osl_atomic_decrement(&rCount) != 0;
+ return osl_atomic_decrement(&rCount) != 0;
}
};
More information about the Libreoffice-commits
mailing list