[gtk/gtk-3-24: 1/2] Prevent Quartz/CoreGraphics runtime assertion failures.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] Prevent Quartz/CoreGraphics runtime assertion failures.
- Date: Mon, 17 Feb 2020 15:50:39 +0000 (UTC)
commit a1720b97a40335a8a742bcc8986fcace42a98f28
Author: David Hogan <david q hogan gmail com>
Date: Sun Feb 16 15:33:13 2020 +1100
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.
gdk/quartz/gdkwindow-quartz.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 75facf1133..655d0a5535 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -191,8 +191,11 @@ static void
gdk_window_impl_quartz_release_context (GdkWindowImplQuartz *window_impl,
CGContextRef cg_context)
{
- CGContextRestoreGState (cg_context);
- CGContextSetAllowsAntialiasing (cg_context, TRUE);
+ 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]