fix OnscreenText memory bloat

This commit is contained in:
David Rose 2001-07-05 16:10:07 +00:00
parent fc72fb5ea5
commit 2187975df5
1 changed files with 11 additions and 2 deletions

View File

@ -178,9 +178,18 @@ clean_out_old_nodes() {
while (csi != _cull_states.end()) {
++csnext;
Node *node = (*csi).first;
CullState *cs = (*csi).second;
if (!cs->has_bin() && cs->is_empty() &&
cs->get_empty_frames_count() > 100) {
if (node->get_ref_count() == 1) {
// If we've got the only outstanding pointer to this node,
// the node was deleted. Drop our reference.
_cull_states.erase(csi);
} else if (!cs->has_bin() && cs->is_empty() &&
cs->get_empty_frames_count() > 100) {
// If the CullState doesn't even have any nodes, delete it after
// 100 frames have elapsed.
_cull_states.erase(csi);
}
csi = csnext;