/* always free the CV's, in the symtable are only not-free'd IS_INDIRECT's */
zend_free_compiled_variables(execute_data);
- if ((EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) &&
- EXPECTED(GC_TYPE(Z_OBJ(execute_data->This)) == IS_OBJECT)) {
+ if (EX_CALL_INFO() & ZEND_CALL_RELEASE_THIS) {
OBJ_RELEASE(Z_OBJ(execute_data->This));
}
}
/* Free closure object */
- if ((EX_CALL_INFO() & ZEND_CALL_CLOSURE) &&
- EXPECTED(GC_TYPE(ZEND_CLOSURE_OBJECT(EX(func))) == IS_OBJECT)) {
+ if (EX_CALL_INFO() & ZEND_CALL_CLOSURE) {
OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
}
ZEND_API void ZEND_FASTCALL zend_objects_store_del(zend_object *object) /* {{{ */
{
+ ZEND_ASSERT(GC_REFCOUNT(object) == 0);
+
+ /* GC might have released this object already. */
+ if (UNEXPECTED(GC_TYPE(object) == IS_NULL)) {
+ return;
+ }
+
/* 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
*/
- ZEND_ASSERT(EG(objects_store).object_buckets != NULL);
- ZEND_ASSERT(IS_OBJ_VALID(EG(objects_store).object_buckets[object->handle]));
- ZEND_ASSERT(GC_REFCOUNT(object) == 0);
-
if (!(OBJ_FLAGS(object) & IS_OBJ_DESTRUCTOR_CALLED)) {
GC_ADD_FLAGS(object, IS_OBJ_DESTRUCTOR_CALLED);
uint32_t handle = object->handle;
void *ptr;
+ ZEND_ASSERT(EG(objects_store).object_buckets != NULL);
+ ZEND_ASSERT(IS_OBJ_VALID(EG(objects_store).object_buckets[object->handle]));
EG(objects_store).object_buckets[handle] = SET_OBJ_INVALID(object);
if (!(OBJ_FLAGS(object) & IS_OBJ_FREE_CALLED)) {
GC_ADD_FLAGS(object, IS_OBJ_FREE_CALLED);