From 3775c92208826f42aef18d0ec6b4408d4de3ff6d Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 23 Mar 2016 09:03:56 +0100 Subject: [PATCH] Fix graphical issues when closing UIs in Ableton Live --- dgl/src/Image.cpp | 2 ++ dgl/src/pugl/pugl_osx.m | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dgl/src/Image.cpp b/dgl/src/Image.cpp index c34eadb6..b79b8d44 100644 --- a/dgl/src/Image.cpp +++ b/dgl/src/Image.cpp @@ -68,7 +68,9 @@ Image::~Image() { if (fTextureId != 0) { +#ifndef DISTRHO_OS_MAC // FIXME glDeleteTextures(1, &fTextureId); +#endif fTextureId = 0; } } diff --git a/dgl/src/pugl/pugl_osx.m b/dgl/src/pugl/pugl_osx.m index 5909d67e..82985fbe 100644 --- a/dgl/src/pugl/pugl_osx.m +++ b/dgl/src/pugl/pugl_osx.m @@ -199,8 +199,6 @@ puglDisplay(PuglView* view) - (void) reshape { - [[self openGLContext] update]; - if (!puglview) { /* NOTE: Apparently reshape gets called when the GC gets around to deleting the view (?), so we must have reset puglview to NULL when @@ -209,6 +207,8 @@ puglDisplay(PuglView* view) return; } + [[self openGLContext] update]; + NSRect bounds = [self bounds]; int width = bounds.size.width; int height = bounds.size.height; @@ -438,11 +438,13 @@ void puglLeaveContext(PuglView* view, bool flush) { #ifdef PUGL_HAVE_GL - if (view->ctx_type == PUGL_GL && flush) { - if (view->impl->glview->doubleBuffered) { - [[view->impl->glview openGLContext] flushBuffer]; - } else { - glFlush(); + if (view->ctx_type == PUGL_GL) { + if (flush) { + if (view->impl->glview->doubleBuffered) { + [[view->impl->glview openGLContext] flushBuffer]; + } else { + glFlush(); + } } //[NSOpenGLContext clearCurrentContext]; }