[grits] Fix crash when unloading the root tile



commit e614b9b78a6d27c950e1face5226d32a29ee90df
Author: Andy Spencer <andy753421 gmail com>
Date:   Tue Feb 14 03:39:12 2012 +0000

    Fix crash when unloading the root tile

 src/objects/grits-tile.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/objects/grits-tile.c b/src/objects/grits-tile.c
index 649d0f4..34906e2 100644
--- a/src/objects/grits-tile.c
+++ b/src/objects/grits-tile.c
@@ -217,7 +217,8 @@ void grits_tile_update(GritsTile *tile, GritsPoint *eye,
 	 * resolution for this part? */
 	gint xs = G_N_ELEMENTS(tile->children);
 	gint ys = G_N_ELEMENTS(tile->children[0]);
-	if (_grits_tile_precise(eye, &tile->edge, res, width/xs, height/ys)) {
+	if (tile->parent && _grits_tile_precise(eye, &tile->edge,
+				res, width/xs, height/ys)) {
 		GRITS_OBJECT(tile)->hidden = TRUE;
 		return;
 	}
@@ -311,9 +312,9 @@ GritsTile *grits_tile_gc(GritsTile *root, time_t atime,
 		if (root->children[x][y])
 			has_children = TRUE;
 	}
-	//g_debug("GritsTile: gc - %p->atime=%u < atime=%u",
-	//		root, (guint)root->atime, (guint)atime);
-	if (!has_children && root->atime < atime &&
+	//g_debug("GritsTile: gc - %p kids=%d time=%d data=%d load=%d",
+	//	root, !!has_children, root->atime < atime, !!root->data, !!root->load);
+	if (root->parent && !has_children && root->atime < atime &&
 			(root->data || !root->load)) {
 		//g_debug("GritsTile: gc/free - %p", root);
 		if (root->data)



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