diff options
author | Marcus Boerger <helly@php.net> | 2004-02-25 21:39:59 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2004-02-25 21:39:59 +0000 |
commit | ccef2cfb67019ab91826389e8111727c82581a78 (patch) | |
tree | eedd3dc4a5cf3653ce84f01f20446f50eb698fd2 /Zend/zend_objects_API.c | |
parent | b87a245207bdd1e5010bcb6b389c8a4365e6938b (diff) | |
download | php-git-ccef2cfb67019ab91826389e8111727c82581a78.tar.gz |
As Andi found out the dtor may increase the refcount.
Diffstat (limited to 'Zend/zend_objects_API.c')
-rw-r--r-- | Zend/zend_objects_API.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index 330879cc0c..d6e1782cb8 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -134,16 +134,17 @@ ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) obj->dtor(obj->object, handle TSRMLS_CC); } } - if (obj->free_storage) { - obj->free_storage(obj->object TSRMLS_CC); + if (obj->refcount == 0) { + if (obj->free_storage) { + obj->free_storage(obj->object TSRMLS_CC); + } + ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(); } - ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(); -#if ZEND_DEBUG_OBJECTS - fprintf(stderr, "Deallocated object id #%d\n", handle); -#endif } #if ZEND_DEBUG_OBJECTS - else { + if (obj->refcount == 0) { + fprintf(stderr, "Deallocated object id #%d\n", handle); + } else { fprintf(stderr, "Decreased refcount of object id #%d\n", handle); } #endif |