gnome-games r8668 - trunk/gnometris



Author: jclinton
Date: Fri Feb  6 16:57:17 2009
New Revision: 8668
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8668&view=rev

Log:
Provide for additional default initialized state to avoid crashers

I should have provided this default state to begin with. Note that this
change has a known issue whereby the ctor for the Renderer class calls
the drawCell() function of the base class regardless of whether the ctor
was called during subclass initialization.

Modified:
   trunk/gnometris/preview.cpp
   trunk/gnometris/renderer.cpp

Modified: trunk/gnometris/preview.cpp
==============================================================================
--- trunk/gnometris/preview.cpp	(original)
+++ trunk/gnometris/preview.cpp	Fri Feb  6 16:57:17 2009
@@ -30,7 +30,10 @@
 #define PREVIEW_SIZE 5
 
 Preview::Preview():
+	width(0),
+	height(0),
 	blocknr(-1),
+	color(-1),
 	themeID(-1),
 	renderer(NULL),
 	enabled(true)

Modified: trunk/gnometris/renderer.cpp
==============================================================================
--- trunk/gnometris/renderer.cpp	(original)
+++ trunk/gnometris/renderer.cpp	Fri Feb  6 16:57:17 2009
@@ -84,15 +84,17 @@
 {
 	pxwidth = pxw == 0 ? 1 : pxw;
 	pxheight = pxh == 0 ? 1 : pxh;
-	for (int i = 0; i<NCOLOURS; i++) {
-		cache[i] = clutter_cairo_new (pxwidth, pxheight);
+	for (int i = 0; i < NCOLOURS; i++) {
+		cache[i] = NULL;
 	}
+	rescaleCache (pxwidth, pxheight);
 }
 
 Renderer::~Renderer ()
 {
 	for (int i = 0; i<NCOLOURS; i++) {
-		g_object_unref (CLUTTER_ACTOR(cache[i]));
+		if (cache[i])
+			clutter_actor_destroy (CLUTTER_ACTOR(cache[i]));
 	}
 }
 



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