From ee08eff11a4e8a646134fa9ea9dd2a0cd2a8a1fe Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 9 Aug 2019 14:19:19 +0000 Subject: [PATCH] GLCtrl: ExecuteGL for GTK, static memory leaks in opengl driver now ignored git-svn-id: svn://ultimatepp.org/upp/trunk@13533 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/GLCtrl/GtkGLCtrl.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/uppsrc/GLCtrl/GtkGLCtrl.cpp b/uppsrc/GLCtrl/GtkGLCtrl.cpp index b90bcfe47..e52dd51b4 100644 --- a/uppsrc/GLCtrl/GtkGLCtrl.cpp +++ b/uppsrc/GLCtrl/GtkGLCtrl.cpp @@ -33,6 +33,8 @@ EXITBLOCK { void GLCtrl::Create() { + MemoryIgnoreLeaksBlock __; + Ctrl *top = GetTopCtrl(); if(!top) return; @@ -136,11 +138,9 @@ void GLCtrl::State(int reason) } } -void GLCtrl::Paint(Draw& w) +void GLCtrl::ExecuteGL(Event<> paint, bool swap_buffers) { - Size sz = GetSize(); - if(!s_GLXContext || sz.cx == 0 || sz.cy == 0) - return; + MemoryIgnoreLeaksBlock __; glXMakeCurrent(s_Display, win, s_GLXContext); @@ -148,9 +148,9 @@ void GLCtrl::Paint(Draw& w) glewInit(); } - DoGLPaint(); + paint(); - if(doubleBuffering) + if(swap_buffers) glXSwapBuffers(s_Display, win); else glFlush(); @@ -158,6 +158,15 @@ void GLCtrl::Paint(Draw& w) glXMakeCurrent(s_Display, None, NULL); } +void GLCtrl::Paint(Draw& w) +{ + Size sz = GetSize(); + if(!s_GLXContext || sz.cx == 0 || sz.cy == 0) + return; + + ExecuteGL([&] { DoGLPaint(); }, doubleBuffering); +} + } #endif