[gtk/wip/otte/display-gl: 3/6] drawcontext: Guard begin/end_frame() against non-surface contexts
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/display-gl: 3/6] drawcontext: Guard begin/end_frame() against non-surface contexts
- Date: Wed, 20 Oct 2021 18:44:21 +0000 (UTC)
commit ea14e94eaf96079cb18cce6bb39a74b0933771f0
Author: Benjamin Otte <otte redhat com>
Date: Wed Oct 20 20:07:37 2021 +0200
drawcontext: Guard begin/end_frame() against non-surface contexts
This can happen now with gdk_display_create_gl_context().
gdk/gdkdrawcontext.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdkdrawcontext.c b/gdk/gdkdrawcontext.c
index b51e1139dd..8ab405e25b 100644
--- a/gdk/gdkdrawcontext.c
+++ b/gdk/gdkdrawcontext.c
@@ -276,7 +276,8 @@ gdk_draw_context_get_surface (GdkDrawContext *context)
/**
* gdk_draw_context_begin_frame:
- * @context: the `GdkDrawContext` used to draw the frame
+ * @context: the `GdkDrawContext` used to draw the frame. The context must
+ * have a surface.
* @region: minimum region that should be drawn
*
* Indicates that you are beginning the process of redrawing @region
@@ -308,7 +309,10 @@ void
gdk_draw_context_begin_frame (GdkDrawContext *context,
const cairo_region_t *region)
{
+ GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
+
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
+ g_return_if_fail (priv->surface != NULL);
g_return_if_fail (region != NULL);
gdk_draw_context_begin_frame_full (context, FALSE, region);
@@ -411,6 +415,7 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
+ g_return_if_fail (priv->surface != NULL);
if (GDK_SURFACE_DESTROYED (priv->surface))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]