[maemo-commits] [maemo-commits] r19405 - in projects/haf/trunk/clutter0.8: clutter/eglx debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Oct 1 14:18:55 EEST 2009
Author: kihamala
Date: 2009-10-01 14:18:49 +0300 (Thu, 01 Oct 2009)
New Revision: 19405

Modified:
   projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c
   projects/haf/trunk/clutter0.8/debian/changelog
Log:
plug a memory leak



Modified: projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c
===================================================================
--- projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c	2009-10-01 08:52:59 UTC (rev 19404)
+++ projects/haf/trunk/clutter0.8/clutter/eglx/clutter-eglx-texture-pixmap.c	2009-10-01 11:18:49 UTC (rev 19405)
@@ -95,6 +95,8 @@
 
   /* If the pixmap has changed, we'll want to try and recreate the surface */
   gboolean      pixmap_changed;
+
+  gboolean      dispose_called;
 };
 
 void
@@ -180,6 +182,7 @@
   priv->current_pixmap_depth = 0;
   priv->current_pixmap_width = 0;
   priv->current_pixmap_height = 0;
+  priv->dispose_called = FALSE;
 
   if (_ext_check_done == FALSE)
     {
@@ -211,10 +214,23 @@
 
   priv = CLUTTER_EGLX_TEXTURE_PIXMAP (object)->priv;
 
+  /* this dispose handler is called twice because of how
+   * clutter_actor_destroy works */
+  if (priv->dispose_called)
+    return;
+
   if (priv->egl_surface != EGL_NO_SURFACE)
     clutter_eglx_texture_pixmap_surface_destroy(CLUTTER_ACTOR(object));
 
+  if (priv->texture_id)
+    {
+      glDeleteTextures (1, &priv->texture_id);
+      priv->texture_id = 0;
+    }
+
   G_OBJECT_CLASS (clutter_eglx_texture_pixmap_parent_class)->dispose (object);
+
+  priv->dispose_called = TRUE;
 }
 
 static gboolean
@@ -362,6 +378,7 @@
       g_debug ("%s: Unable to create cogl texture", __FUNCTION__);
 
       glDeleteTextures (1, &priv->texture_id);
+      priv->texture_id = 0;
 
       CLUTTER_NOTE (TEXTURE, "Falling back to X11 manual mechanism");
       priv->use_fallback = TRUE;

Modified: projects/haf/trunk/clutter0.8/debian/changelog
===================================================================
--- projects/haf/trunk/clutter0.8/debian/changelog	2009-10-01 08:52:59 UTC (rev 19404)
+++ projects/haf/trunk/clutter0.8/debian/changelog	2009-10-01 11:18:49 UTC (rev 19405)
@@ -1,8 +1,12 @@
 clutter (0.8.2-0maemo51~unreleased) unstable; urgency=low
 
-  * foo
+  * clutter/eglx/clutter-eglx-texture-pixmap.c
+    (clutter_eglx_texture_pixmap_dispose): Delete the texture to avoid a
+    memory leak.
+    Fixes: NB#134230 - Memory leak in hildon-desktop when starting and closing
+    Media Player
 
- -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Tue, 29 Sep 2009 14:13:20 +0300
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Thu, 01 Oct 2009 14:13:17 +0300
 
 clutter (0.8.2-0maemo50) unstable; urgency=low
 

More information about the maemo-commits mailing list