From 65f6ad26ed167b9baf0e63ba0b36f56a3de9c635 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 3 Oct 2012 13:50:02 +0200 Subject: Mac: Safely dispose of scrollbars temporary NSGraphicsContext When rendering transient scrollbars, we instanciate a specialised NSGraphicsContext since those need non-opaque rendering. This context is being used as current context, but it was never properly released and the previous context never properly restored. Task-number: QTBUG-27327 Change-Id: I4e867e64a09368dbe64b84b17f07fd8e57bbae24 Reviewed-by: Teemu Katajisto Reviewed-by: Richard Moe Gustavsen --- src/widgets/styles/qmacstyle_mac.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 65a39ba304..585e510dd3 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -5152,6 +5152,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } CGContextSaveGState(cg); + [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]]; @@ -5230,6 +5231,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } CGContextEndTransparencyLayer(cg); + + [NSGraphicsContext restoreGraphicsState]; CGContextRestoreGState(cg); } else #endif -- cgit v1.2.3