diff options
author | Dmitry Stogov <dmitry@php.net> | 2008-02-19 17:05:41 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2008-02-19 17:05:41 +0000 |
commit | caee59b856e915c14a37924349c93112a6534b51 (patch) | |
tree | 122c9c9045c76685c85d27034330b1c6dc7c2720 /Zend | |
parent | f4dc0f293d26fc20f95496f0657e0dde7f6b472f (diff) | |
download | php-git-caee59b856e915c14a37924349c93112a6534b51.tar.gz |
everted (this part was committed by mistake)
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_objects_API.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index f87472aaf0..2fded2a1f9 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -158,7 +158,8 @@ ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSR #define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \ EG(objects_store).object_buckets[handle].bucket.free_list.next = EG(objects_store).free_list_head; \ - EG(objects_store).free_list_head = handle; + EG(objects_store).free_list_head = handle; \ + EG(objects_store).object_buckets[handle].valid = 0; ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) { @@ -185,12 +186,13 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR return; } + obj = &EG(objects_store).object_buckets[handle].bucket.obj; + /* Make sure we hold a reference count during the destructor call otherwise, when the destructor ends the storage might be freed when the refcount reaches 0 a second time */ if (EG(objects_store).object_buckets[handle].valid) { - obj = &EG(objects_store).object_buckets[handle].bucket.obj; if (obj->refcount == 1) { if (!EG(objects_store).object_buckets[handle].destructor_called) { EG(objects_store).object_buckets[handle].destructor_called = 1; @@ -204,7 +206,6 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR } } if (obj->refcount == 1) { - EG(objects_store).object_buckets[handle].valid = 0; GC_REMOVE_ZOBJ_FROM_BUFFER(obj); if (obj->free_storage) { zend_try { @@ -216,20 +217,19 @@ ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSR ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(); } } + } - obj->refcount--; + obj->refcount--; #if ZEND_DEBUG_OBJECTS - if (obj->refcount == 0) { - fprintf(stderr, "Deallocated object id #%d\n", handle); - } else { - fprintf(stderr, "Decreased refcount of object id #%d\n", handle); - } + if (obj->refcount == 0) { + fprintf(stderr, "Deallocated object id #%d\n", handle); + } else { + fprintf(stderr, "Decreased refcount of object id #%d\n", handle); + } #endif - - if (failure) { - zend_bailout(); - } + if (failure) { + zend_bailout(); } } |