# HG changeset patch # User Waqas Hussain # Date 1292701999 -18000 # Node ID ef645a5bb132b428fd3c3199eaa845dc69f6dc06 # Parent d46287c02cb1bfbf6b825838585530545352f80c util.events: Remove an event's table when it has no more handlers. diff -r d46287c02cb1 -r ef645a5bb132 util/events.lua --- a/util/events.lua Sat Dec 18 21:35:42 2010 +0100 +++ b/util/events.lua Sun Dec 19 00:53:19 2010 +0500 @@ -45,6 +45,9 @@ if map then map[handler] = nil; handlers[event] = nil; + if next(map) == nil then + event_map[event] = nil; + end end end; local function add_handlers(handlers)