app/internal/wm: [macOS] release context only if it was created

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-05-16 12:01:38 +02:00
parent 566b4b166b
commit d5fc7fc8f6
+2
View File
@@ -58,10 +58,12 @@ func (c *context) API() gpu.API {
} }
func (c *context) Release() { func (c *context) Release() {
if c.ctx != 0 {
C.gio_clearCurrentContext() C.gio_clearCurrentContext()
C.CFRelease(c.ctx) C.CFRelease(c.ctx)
c.ctx = 0 c.ctx = 0
} }
}
func (c *context) Present() error { func (c *context) Present() error {
// Assume the caller already locked the context. // Assume the caller already locked the context.