Prevent Quartz/CoreGraphics runtime assertion failures.

gdk_window_impl_quartz_release_context () can be called with a NULL CGContextRef. This causes CoreGraphics assertion failures when debugging a Gtk application in Xcode, as the code was blindly passing that NULL to CGContextRestoreGState () and CGContextSetAllowsAntialiasing (). Given that the matching pair of CGContextSaveGState () and CGContextSetAllowsAntialiasing () calls are already checking for a NULL CGContextRef, it seems reasonable to wrap these calls in a NULL check.
This commit is contained in:
David Hogan
2020-02-16 15:33:13 +11:00
parent 1c4d5fbe20
commit a1720b97a4

View File

@ -191,8 +191,11 @@ static void
gdk_window_impl_quartz_release_context (GdkWindowImplQuartz *window_impl,
CGContextRef cg_context)
{
if (cg_context)
{
CGContextRestoreGState (cg_context);
CGContextSetAllowsAntialiasing (cg_context, TRUE);
}
/* See comment in gdk_quartz_window_get_context(). */
if (window_impl->in_paint_rect_count == 0)