Software /
code /
prosody
Comparison
core/moduleapi.lua @ 6654:22a7ee3379bc
moduleapi: Clear self.event_handlers when unhooking an event, to prevent leaks
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 06 May 2015 19:01:16 +0100 |
parent | 6653:8241eac507c3 |
child | 6655:a99ed5f5f709 |
comparison
equal
deleted
inserted
replaced
6653:8241eac507c3 | 6654:22a7ee3379bc |
---|---|
92 self.event_handlers:set(object, event, handler, true); | 92 self.event_handlers:set(object, event, handler, true); |
93 return object.add_handler(event, handler, priority); | 93 return object.add_handler(event, handler, priority); |
94 end | 94 end |
95 | 95 |
96 function api:unhook_object_event(object, event, handler) | 96 function api:unhook_object_event(object, event, handler) |
97 self.event_handlers:set(object, event, handler, nil); | |
97 return object.remove_handler(event, handler); | 98 return object.remove_handler(event, handler); |
98 end | 99 end |
99 | 100 |
100 function api:hook(event, handler, priority) | 101 function api:hook(event, handler, priority) |
101 return self:hook_object_event((hosts[self.host] or prosody).events, event, handler, priority); | 102 return self:hook_object_event((hosts[self.host] or prosody).events, event, handler, priority); |