Assert correctness in decrement_reference_count()

This commit is contained in:
Tom Eastep 2011-02-16 13:16:42 -08:00
parent fa8c8f5850
commit 300d931922

View File

@ -762,9 +762,10 @@ sub increment_reference_count( $$ ) {
sub decrement_reference_count( $$ ) {
my ($toref, $chain) = @_;
if ( $toref && $toref->{referenced} && $toref->{references}{$chain} ) {
if ( $toref && $toref->{referenced} ) {
assert($toref->{references}{$chain} > 0 );
delete $toref->{references}{$chain} unless --$toref->{references}{$chain};
delete_chain( $toref ) unless ( keys %{$toref->{references}} );
delete_chain( $toref ) unless ( keys %{$toref->{references}} );
}
}