mirror of
https://github.com/imezx/Warp.git
synced 2025-06-19 21:29:17 +00:00
Fix: Destroying a Signal
This commit is contained in:
parent
aa693aee4f
commit
eba9f79655
1 changed files with 10 additions and 0 deletions
|
@ -39,9 +39,13 @@ end
|
|||
|
||||
function Signal:Disconnect(key: string)
|
||||
self[key]:Disconnect()
|
||||
self[key] = nil
|
||||
end
|
||||
|
||||
function Signal:DisconnectAll(): ()
|
||||
for _, handle in self do
|
||||
handle:Disconnect()
|
||||
end
|
||||
table.clear(self)
|
||||
end
|
||||
|
||||
|
@ -84,6 +88,12 @@ end
|
|||
|
||||
function Signal:Destroy(): ()
|
||||
self:DisconnectAll()
|
||||
for idx: string, signal in Signals do
|
||||
if self :: any == signal then
|
||||
Signals[idx] = nil
|
||||
break
|
||||
end
|
||||
end
|
||||
setmetatable(self, nil)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue