Skip to content

Commit

Permalink
#11 - fix stream destruction
Browse files Browse the repository at this point in the history
  • Loading branch information
ichiriac committed Mar 12, 2017
1 parent 34f70c6 commit e81d9df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion libevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ ZEND_RSRC_DTOR_FUNC(_php_event_dtor) /* {{{ */
if (Z_TYPE_P(&event->stream_id) != IS_NULL) {
zend_list_delete(Z_RES_P(&event->stream_id));
}
zval_ptr_dtor(&event->stream_id);

_php_event_callback_free(event->callback);

Expand Down
10 changes: 9 additions & 1 deletion tests/libevent006.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ var_dump(event_base_set($ev1, $base));
var_dump(event_add($ev1));
var_dump(event_base_loop($base, EVLOOP_ONCE));
var_dump(event_del($ev1));
event_free($ev1);
var_dump(event_free($ev1));
unset($ev1);
var_dump($fd);

// second event reader
echo "\n2nd try\n";
$ev2 = event_new();
var_dump(event_set($ev2, $fd, EV_READ | EV_PERSIST, "foo", array($ev2, $base)));
var_dump(event_base_set($ev2, $base));
var_dump(event_add($ev2));
var_dump(event_base_loop($base, EVLOOP_ONCE));
var_dump(event_del($ev2));
var_dump(event_free($ev2));
unset($ev2);

?>
Expand All @@ -51,9 +54,14 @@ bool(true)
string(1) "0"
int(0)
bool(true)
NULL
resource(6) of type (stream)

2n try
bool(true)
bool(true)
bool(true)
string(1) "1"
int(0)
bool(true)
NULL

0 comments on commit e81d9df

Please sign in to comment.