[gtk/wip/otte/gl-hdr: 4/7] cairo-gl: Don't leak framebuffers




commit 7bac081d22ab8348297b662db075c4c1721bd121
Author: Benjamin Otte <otte redhat com>
Date:   Wed Oct 6 01:23:02 2021 +0200

    cairo-gl: Don't leak framebuffers
    
    The framebufffer was cached, but never deleted. And because this
    function is deprecated and nobody should ever use it: Don't bother with
    caching now.

 gdk/gdkgl.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index c6a73a7071..f5052f5ca0 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -355,10 +355,8 @@ gdk_cairo_draw_from_gl (cairo_t              *cr,
   es_use_bgra = gdk_gl_context_use_es_bgra (paint_context);
 
   gdk_gl_context_make_current (paint_context);
-  paint_data = gdk_gl_context_get_paint_data (paint_context);
 
-  if (paint_data->tmp_framebuffer == 0)
-    glGenFramebuffers (1, &paint_data->tmp_framebuffer);
+  glGenFramebuffers (1, &framebuffer);
 
   if (source_type == GL_RENDERBUFFER)
     {
@@ -397,7 +395,6 @@ gdk_cairo_draw_from_gl (cairo_t              *cr,
 
   cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
 
-  framebuffer = paint_data->tmp_framebuffer;
   glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
 
   if (source_type == GL_RENDERBUFFER)
@@ -428,6 +425,8 @@ gdk_cairo_draw_from_gl (cairo_t              *cr,
 
   glBindFramebuffer (GL_FRAMEBUFFER, 0);
 
+  glDeleteFramebuffers (1, &framebuffer);
+
   cairo_surface_mark_dirty (image);
 
   cairo_set_source_surface (cr, image, 0, 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]