mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
Free loop handle only when object freed
This commit is contained in:
parent
4608148622
commit
3c89bc46a5
10
php_uv.c
10
php_uv.c
@ -1250,7 +1250,14 @@ void static destruct_uv_loop(zend_object *obj)
|
||||
/* for proper destruction: close all handles, let libuv call close callback and then close and free the loop */
|
||||
uv_walk(loop, destruct_uv_loop_walk_cb, NULL);
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
uv_loop_close(loop);
|
||||
}
|
||||
}
|
||||
|
||||
void static free_uv_loop(zend_object *obj)
|
||||
{
|
||||
php_uv_loop_t *loop_obj = (php_uv_loop_t *) obj;
|
||||
if (loop_obj != UV_G(default_loop)) {
|
||||
uv_loop_close(&loop_obj->loop);
|
||||
}
|
||||
if (loop_obj->gc_buffer) {
|
||||
efree(loop_obj->gc_buffer);
|
||||
@ -2751,6 +2758,7 @@ PHP_MINIT_FUNCTION(uv)
|
||||
memcpy(&uv_loop_handlers, &uv_default_handlers, sizeof(zend_object_handlers));
|
||||
uv_loop_handlers.get_gc = php_uv_loop_get_gc;
|
||||
uv_loop_handlers.dtor_obj = destruct_uv_loop;
|
||||
uv_loop_handlers.free_obj = free_uv_loop;
|
||||
|
||||
uv_sockaddr_ce = php_uv_register_internal_class("UVSockAddr");
|
||||
uv_sockaddr_ce->ce_flags |= ZEND_ACC_ABSTRACT;
|
||||
|
Loading…
Reference in New Issue
Block a user