gnome-games r8650 - trunk/gnometris



Author: jclinton
Date: Tue Feb  3 18:56:12 2009
New Revision: 8650
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8650&view=rev

Log:
Fix invalid subclass drawCell call and a memory leak on theme change.

drawCell of the parent class was getting called in the ctor incorrectly.

Also, we were leaking the ClutterActors used as caches.

Modified:
   trunk/gnometris/renderer.cpp

Modified: trunk/gnometris/renderer.cpp
==============================================================================
--- trunk/gnometris/renderer.cpp	(original)
+++ trunk/gnometris/renderer.cpp	Tue Feb  3 18:56:12 2009
@@ -84,22 +84,21 @@
 {
 	pxwidth = pxw;
 	pxheight = pxh;
-
 	if (pxwidth == 0 || pxheight == 0) {
 		for (int i = 0; i<NCOLOURS; i++)
 			cache[i] = NULL;
 	} else {
 		for (int i = 0; i<NCOLOURS; i++) {
 			cache[i] = clutter_cairo_new (pxwidth, pxheight);
-			cairo_t *cr = clutter_cairo_create (CLUTTER_CAIRO(cache[i]));
-			drawCell (cr, i);
-			cairo_destroy (cr);
 		}
 	}
 }
 
 Renderer::~Renderer ()
 {
+	for (int i = 0; i<NCOLOURS; i++) {
+		g_object_unref (CLUTTER_ACTOR(cache[i]));
+	}
 }
 
 ClutterActor* Renderer::getCacheCellById (gint id)



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