util.events: Remove an event's table when it has no more handlers.
authorWaqas Hussain <waqas20@gmail.com>
Sat, 18 Dec 2010 19:53:19 +0000 (00:53 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Sat, 18 Dec 2010 19:53:19 +0000 (00:53 +0500)
util/events.lua

index 8e05072d55d958452638d9862dfcb1bc1853274b..412acccd762cb755a9c0627f2689ea82b5989465 100644 (file)
@@ -45,6 +45,9 @@ function new()
                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)