[gtk/wip/chergert/gdk-macos-gl-renderer: 8/26] gl: hold ref to previous context when replacing
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/gdk-macos-gl-renderer: 8/26] gl: hold ref to previous context when replacing
- Date: Thu, 29 Oct 2020 00:12:12 +0000 (UTC)
commit 590a7c40cf3788590b9d7be2f9b5b9d339a5bd75
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 21 17:40:39 2020 -0700
gl: hold ref to previous context when replacing
On macOS, if we don't hold on to this reference we can get
in a stack overflow condition disposing the GL context.
gdk/gdkglcontext.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 5d73080b9b..a7ea187f28 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -1114,8 +1114,16 @@ gdk_gl_context_make_current (GdkGLContext *context)
if (gdk_display_make_gl_context_current (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)),
context))
{
+ GdkGLContext *last = g_private_get (&thread_current_context);
+
+ if (last)
+ g_object_ref (last);
+
g_private_replace (&thread_current_context, g_object_ref (context));
gdk_gl_context_check_extensions (context);
+
+ if (last)
+ g_object_unref (last);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]