mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
fix crash when dtor is fialing on shutdown
This commit is contained in:
parent
2a2d49b947
commit
3755c03291
@ -190,6 +190,9 @@ void init_executor(TSRMLS_D)
|
||||
void shutdown_destructors(TSRMLS_D) {
|
||||
zend_try {
|
||||
zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
|
||||
} zend_catch {
|
||||
/* if we couldn't destruct cleanly, mark all objects as destructed anyway */
|
||||
zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
|
||||
} zend_end_try();
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,16 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC)
|
||||
{
|
||||
zend_uint i = 1;
|
||||
|
||||
for (i = 1; i < objects->top ; i++) {
|
||||
if (objects->object_buckets[i].valid) {
|
||||
objects->object_buckets[i].destructor_called = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC)
|
||||
{
|
||||
|
@ -57,6 +57,7 @@ typedef struct _zend_objects_store {
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint init_size);
|
||||
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC);
|
||||
ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSRMLS_DC);
|
||||
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects);
|
||||
|
||||
/* Store API functions */
|
||||
|
Loading…
Reference in New Issue
Block a user