From d5fc7fc8f68659a3378e0a62bdaf091e71e6e291 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 16 May 2021 12:01:38 +0200 Subject: [PATCH] app/internal/wm: [macOS] release context only if it was created Signed-off-by: Elias Naur --- app/internal/wm/gl_macos.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/internal/wm/gl_macos.go b/app/internal/wm/gl_macos.go index 40d16e21..7c231ae1 100644 --- a/app/internal/wm/gl_macos.go +++ b/app/internal/wm/gl_macos.go @@ -58,9 +58,11 @@ func (c *context) API() gpu.API { } func (c *context) Release() { - C.gio_clearCurrentContext() - C.CFRelease(c.ctx) - c.ctx = 0 + if c.ctx != 0 { + C.gio_clearCurrentContext() + C.CFRelease(c.ctx) + c.ctx = 0 + } } func (c *context) Present() error {