]> Pileus Git - grits/commitdiff
Fix crash when unloading the root tile
authorAndy Spencer <andy753421@gmail.com>
Tue, 14 Feb 2012 03:39:12 +0000 (03:39 +0000)
committerAndy Spencer <andy753421@gmail.com>
Tue, 14 Feb 2012 04:24:08 +0000 (04:24 +0000)
src/objects/grits-tile.c

index 649d0f42970936e225e7c6b6ab2715f4f6e09bd7..34906e218e1842a2c08f60d99c5adab88f80be0b 100644 (file)
@@ -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)