diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-10-08 11:21:45 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2018-12-12 13:39:40 +0100 |
commit | 5a430e618efc3d230da460af566e4db26eb8e74e (patch) | |
tree | 694e275839676c8f9b76cee5e6c3a5dd34e54ef8 | |
parent | cde3b1fbdf2341c00afcefc42ae061b2970b4da3 (diff) |
tdf#121778: Work around odd macOS 10.14 graphicsContextWithWindow failure
Although Stephan's original commit message below talks mainly about a
unit test, this change helps at least in tdf#121778, too, and possibly
other cases.
It is interesting that wihout this change, a lot of these warnings are
printed before the crash:
warn:vcl.quartz:42670:52899343:vcl/quartz/salvd.cxx:312: No context
Original commit message:
When running on macOS 10.14, both master and libreoffice-6-1 (at least) started
to fail CppunitTest_vcl_bitmap_render_test with
> /Users/stephan/Software/lo2/core/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx:90: Assertion
> Test name: BitmapRenderTest::testTdf113918
> equality assertion failed
> - Expected: mcBlueOrIndex: 255, mcGreen: 255, mcRed: 255, mcAlpha: 0
> - Actual : mcBlueOrIndex: 1, mcGreen: 112, mcRed: 15, mcAlpha: 0
in --enable-debug/--enable-dbgutil builds.
I tracked that down to the OSL_DEBUG_LEVEL>0--only call to
Scheduler::ProcessEventsToIdle in test::BootstrapFixture::setUp
(test/source/bootstrapfixture.cxx). If that call is also included in non-debug
(i.e., OSL_DEBUG_LEVEL=0) builds, or if it is removed from all builds and
instead an unsuspecting
[NSApp nextEventMatchingMask: 0 untilDate: nil inMode: NSDefaultRunLoopMode dequeue: NO];
is added directly before the call to
pVDev->SetOutputSizePixel(Size(2480, 3508));
at the start of BitmapRenderTest::testTdf113918
(vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx:76), the test always fails.
What happens is that, after such a nextEventMatchingMask call done, the call to
NSGraphicsContext graphicsContextWithWindow in AquaSalVirtualDevice::SetSize (as
called from the SetOutputSizePixel call in the test) returns nil, for unclear
reasons.
Until those underlying reasons are understood, change the code of SetSize to
"fall back to a bitmap context" also in case the graphicsContextWithWindow call
returned nil.
Reviewed-on: https://gerrit.libreoffice.org/61519
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit e659c6a1857fbb8e5a6e8ff60fe241483eea32dd)
Change-Id: I604ebd2c444b58610e4ed73ec70af87b0a08e864
Reviewed-on: https://gerrit.libreoffice.org/64597
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Xisco FaulĂ <xiscofauli@libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | vcl/quartz/salvd.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx index 03f37fe67366..355a78de96d2 100644 --- a/vcl/quartz/salvd.cxx +++ b/vcl/quartz/salvd.cxx @@ -272,7 +272,14 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) xCGContext = static_cast<CGContextRef>([pNSContext graphicsPort]); } } - else + // At least on macOS 10.14 during CppunitTests (that have hidden windows), it happens + // that the above + // + // [NSGraphicsContext graphicsContextWithWindow: pNSWindow] + // + // returns nil for unclear reasons; so use the below fallback even if there is a + // pNSWindow but obtaining a graphics context for it fails: + if (xCGContext == nullptr) { // fall back to a bitmap context mnBitmapDepth = 32; |