From e6cfbb24b8280f76fd41e147cc7e0f4548617574 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 1 Nov 2018 12:56:20 -0700 Subject: [PATCH] Return a default surface if the view has no currentContext. Note that the resultind surface will not display on the screen. Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1411 for Gtk2. --- gdk/quartz/gdkdrawable-quartz.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c index 503ea83aa8..e5b6ace48d 100644 --- a/gdk/quartz/gdkdrawable-quartz.c +++ b/gdk/quartz/gdkdrawable-quartz.c @@ -65,15 +65,15 @@ _gdk_windowing_create_cairo_surface (GdkDrawable *drawable, cg_context = gdk_quartz_drawable_get_context (drawable, TRUE); - if (!cg_context) - return NULL; - surface_data = g_new (GdkQuartzCairoSurfaceData, 1); surface_data->drawable = drawable; surface_data->cg_context = cg_context; - surface = cairo_quartz_surface_create_for_cg_context (cg_context, - width, height); + if (cg_context) + surface = cairo_quartz_surface_create_for_cg_context (cg_context, + width, height); + else + surface = cairo_quartz_surface_create(CAIRO_FORMAT_ARGB32, width, height); cairo_surface_set_user_data (surface, &gdk_quartz_cairo_key, surface_data,