diff --git a/src/gdd/gddI.h b/src/gdd/gddI.h index 20be72d5b..b0f9ec777 100644 --- a/src/gdd/gddI.h +++ b/src/gdd/gddI.h @@ -162,13 +162,8 @@ inline gddStatus gdd::unreference(void) const if ( ref_cnt > 1u ) { ref_cnt--; } - else if ( ref_cnt == 0u ) + else if ( ref_cnt == 1u ) { - fprintf(stderr,"gdd reference count underflow!!\n"); - gddAutoPrint("gdd::unreference()",gddErrorUnderflow); - rc=gddErrorUnderflow; - } - else { if ( isManaged() ) { // managed dd always destroys the entire thing if(destruct) destruct->destroy((void *)this); @@ -181,6 +176,11 @@ inline gddStatus gdd::unreference(void) const delete this; } } + else { + fprintf(stderr,"gdd reference count underflow!!\n"); + gddAutoPrint("gdd::unreference()",gddErrorUnderflow); + rc=gddErrorUnderflow; + } return rc; }