diff --git a/lib/Loop/EvDriver.php b/lib/Loop/EvDriver.php index f18cee10..e10846b6 100644 --- a/lib/Loop/EvDriver.php +++ b/lib/Loop/EvDriver.php @@ -125,6 +125,10 @@ public function __destruct() { foreach ($this->events as $event) { $event->stop(); } + + // We need to clear all references to events manually, see + // https://bitbucket.org/osmanov/pecl-ev/issues/31/segfault-in-ev_timer_stop + $this->events = []; } /** @@ -231,6 +235,7 @@ protected function activate(array $watchers) { protected function deactivate(Watcher $watcher) { if (isset($this->events[$id = $watcher->id])) { $this->events[$id]->stop(); + if ($watcher->type === Watcher::SIGNAL) { unset($this->signals[$id]); }