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 <teemu.katajisto@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
Gabriel de Dietrich 2012-10-03 13:50:02 +02:00 committed by The Qt Project
parent bf55c0ac3b
commit 65f6ad26ed

View File

@ -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