mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix object destruction/free in shutdown
- set destructor_called even when no dtor is given - use free_storage even when no dtor hat to be called
This commit is contained in:
parent
98f725b0e0
commit
b0529e5485
1 changed files with 5 additions and 7 deletions
|
@ -49,9 +49,9 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
|
|||
struct _store_object *obj = &objects->object_buckets[i].bucket.obj;
|
||||
|
||||
if (obj->dtor && !objects->object_buckets[i].destructor_called) {
|
||||
objects->object_buckets[i].destructor_called = 1;
|
||||
obj->dtor(obj->object, i TSRMLS_CC);
|
||||
}
|
||||
objects->object_buckets[i].destructor_called = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,13 +133,11 @@ ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
|
|||
if (obj->dtor) {
|
||||
obj->dtor(obj->object, handle TSRMLS_CC);
|
||||
}
|
||||
if (obj->refcount == 0) {
|
||||
if (obj->free_storage) {
|
||||
obj->free_storage(obj->object TSRMLS_CC);
|
||||
}
|
||||
ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST();
|
||||
}
|
||||
}
|
||||
if (obj->free_storage) {
|
||||
obj->free_storage(obj->object TSRMLS_CC);
|
||||
}
|
||||
ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST();
|
||||
#if ZEND_DEBUG_OBJECTS
|
||||
fprintf(stderr, "Deallocated object id #%d\n", handle);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue