From c27e889d4577dd2d4cb09fd79518e1af958ede1d Mon Sep 17 00:00:00 2001 From: Rahix Date: Wed, 17 Apr 2019 22:26:03 +0200 Subject: [PATCH] Cancel listeners when closing Signed-off-by: Rahix --- bc.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bc.lua b/bc.lua index 11622a68c6a7..bbbc067c799a 100644 --- a/bc.lua +++ b/bc.lua @@ -224,6 +224,15 @@ function BaseControl:close() end end + -- Cancel all listeners + for noun, listeners in pairs(self.listeners) do + if self.remote_nouns[noun] ~= nil then + for id in pairs(listeners) do + self:cancel(noun, id) + end + end + end + self.network:stop() setmetatable(self, nil) end