diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-01-17 11:27:25 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-01-17 10:06:56 +0000 |
commit | ebac691388ed71aafd0aaa78efc5810a68486b7f (patch) | |
tree | 0ec95740d2be9641a255fbc59ef2cfcc9ad719e8 | |
parent | fdf95de18ef1891862bdce26669d1ce2c6f24764 (diff) |
Reset BitmapWriteAccess before further bitmap use
It started failing an assertion recently (maybe after the 1-bit images
support drop in commit 21734247d58a6e915b058d8fa55ece949d049613), when
opening Styles sidebar, with this call stack:
ucrtbased.dll!_wassert(const wchar_t * expression, const wchar_t * file_name, unsigned int line_number) Line 444 C++
vcllo.dll!SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode) Line 230 C++
vcllo.dll!BitmapInfoAccess::BitmapInfoAccess(Bitmap & rBitmap, BitmapAccessMode nMode) Line 47 C++
vcllo.dll!Bitmap::AcquireInfoAccess() Line 368 C++
vcllo.dll!vcl::ScopedBitmapAccess<BitmapInfoAccess,Bitmap,&Bitmap::AcquireInfoAccess>::ScopedBitmapAccess<BitmapInfoAccess,Bitmap,&Bitmap::AcquireInfoAccess>(Bitmap & rBitmap) Line 55 C++
vcllo.dll!Bitmap::HasGreyPalette8Bit() Line 291 C++
vcllo.dll!Bitmap::Convert(BmpConversion eConversion) Line 868 C++
vcllo.dll!AlphaMask::AlphaMask(const Bitmap & rBitmap) Line 35 C++
vcllo.dll!BitmapEx::BitmapEx(const Bitmap & rBmp, const AlphaMask & rAlphaMask) Line 142 C++
vcllo.dll!vcl::bitmap::CreateFromData(const unsigned char * pData, long nWidth, long nHeight, long nStride, char nBitCount, bool bReversColors, bool bReverseAlpha) Line 216 C++
...
The comment at the assert in SkiaSalBitmap::AcquireBuffer (that is called
from BitmapInfoAccess ctor) tells:
BitmapWriteAccess stores also a copy of the palette and it can
be modified, so concurrent reading of it might result in inconsistencies
Change-Id: I364060cf3c2073cfd8bf3288140a7ab3604cd2a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145659
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | vcl/source/bitmap/BitmapTools.cxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 7c19c237d57f..164a5606debb 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -212,6 +212,9 @@ BitmapEx CreateFromData(sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHei } } } + // Avoid further bitmap use with unfinished write access + pWrite.reset(); + xMaskAcc.reset(); if (nBitCount == 32) return BitmapEx(aBmp, *pAlphaMask); else |