From e5a592162289732cfc835057b6ab66c550da9b88 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 14 Mar 2001 20:26:54 +0000 Subject: [PATCH] *** empty log message *** --- panda/src/graph/wrt.I | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/panda/src/graph/wrt.I b/panda/src/graph/wrt.I index 94a52b5f97..b429ab6cd7 100644 --- a/panda/src/graph/wrt.I +++ b/panda/src/graph/wrt.I @@ -779,6 +779,25 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, result.write(wrt_cat.spam(false), 2); } #endif + + if (to->get_num_parents(graph_type) != 1) { + // Oops! We *don't* have exactly one parent. This means our + // cache is stale in some surprising way. To recover, we'll + // force a recompute of the cache by asking for the wrt() from + // the very latest timestamp. + + // This, of course, assumes we haven't just asked for the wrt() + // from the very latest timestamp. +#ifndef NDEBUG + if (wrt_cat.is_info()) { + wrt_cat.info() + << "Recovering from stale cache.\n"; + } +#endif + nassertr(as_of != UpdateSeq::fresh(), NULL); + return cached_wrt_subtree(arc, to, UpdateSeq::fresh(), + UpdateSeq::fresh(), result, graph_type); + } nassertr(to->get_num_parents(graph_type) == 1, NULL); NodeRelation *to_arc = to->get_parent(graph_type, 0);