summaryrefslogtreecommitdiff
path: root/vcl/skia/gdiimpl.cxx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-11-16 22:43:51 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-11-17 11:33:32 +0100
commit42e30c24615402c49351f80cc8a47d61d47267c6 (patch)
treeadd7c879ff5b3f852fb181099c1a0524e439705a /vcl/skia/gdiimpl.cxx
parentf4fbb45ee411ffc0a2e20d5d04200e71772a444e (diff)
tdf#138022 Skia don't recreate empty surfaces
Skia can't create empty surfaces, so the recreation will hit the std::abort() in SkiaSalGraphicsImpl::createWindowSurface. Origin of the backtrace is some queued Resize event, which will hit this a few times via SkiaSalGraphicsImpl::checkSurface. This feels a bit like tdf#130831, where VCL tried to track damange for an empty Qt image... Change-Id: I75e22c987ba633e7a403541db8d580df33c68964 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105963 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/skia/gdiimpl.cxx')
-rw-r--r--vcl/skia/gdiimpl.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index e339171d9d80..d89ec093a964 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -277,12 +277,6 @@ SkiaSalGraphicsImpl::~SkiaSalGraphicsImpl()
void SkiaSalGraphicsImpl::Init() {}
-void SkiaSalGraphicsImpl::recreateSurface()
-{
- destroySurface();
- createSurface();
-}
-
void SkiaSalGraphicsImpl::createSurface()
{
SkiaZone zone;
@@ -453,7 +447,17 @@ void SkiaSalGraphicsImpl::checkSurface()
}
else if (GetWidth() != mSurface->width() || GetHeight() != mSurface->height())
{
- if (!avoidRecreateByResize())
+ if (avoidRecreateByResize())
+ return;
+
+ if (!GetWidth() || !GetHeight())
+ {
+ SAL_WARN("vcl.skia", "recreate(" << this << "): can't create empty surface "
+ << Size(GetWidth(), GetHeight())
+ << " => keeping old one!");
+ return;
+ }
+
{
Size oldSize(mSurface->width(), mSurface->height());
// Recreating a surface means that the old SkSurface contents will be lost.
@@ -468,7 +472,10 @@ void SkiaSalGraphicsImpl::checkSurface()
flushDrawing();
snapshot = SkiaHelper::makeCheckedImageSnapshot(mSurface);
}
- recreateSurface();
+
+ destroySurface();
+ createSurface();
+
if (snapshot)
{
SkPaint paint;