[GtkGLExt] It's better gdk_gl_context_finalize() destroys gl_context.



Hi,

This is the same contents of the patch #1496247 on SF.net:
 http://sourceforge.net/tracker/index.php?func=detail&aid=1496247&group_id=54333&atid=473436

We may cause memory leak if we only call
g_object_unref(gl_context) because
gdk_gl_context_finalize() doesn't call
_gdk_gl_context_destroy(). We can avoid the memory leak
by calling gdk_gl_context_destroy() instead of
g_object_unref() but this workaround has some problems.
* This isn't GLib-ish.
* We can't always call gdk_gl_context_destroy() for
doing unref gl_context. Someone may need gl_context.

Thanks,
--
kou
Index: gdk/gdkglcontext.c
===================================================================
RCS file: /cvsroot/gtkglext/gtkglext/gdk/gdkglcontext.c,v
retrieving revision 1.27
diff -u -p -r1.27 gdkglcontext.c
--- gdk/gdkglcontext.c	20 Feb 2004 09:38:10 -0000	1.27
+++ gdk/gdkglcontext.c	28 May 2006 02:55:42 -0000
@@ -70,8 +70,12 @@ gdk_gl_context_class_init (GdkGLContextC
 static void
 gdk_gl_context_finalize (GObject *object)
 {
+  GdkGLContext *glcontext = GDK_GL_CONTEXT (object);
+
   GDK_GL_NOTE_FUNC_PRIVATE ();
 
+  _gdk_gl_context_destroy (glcontext);
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 


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