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)
|
function Signal:Disconnect(key: string)
|
||||||
self[key]:Disconnect()
|
self[key]:Disconnect()
|
||||||
|
self[key] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function Signal:DisconnectAll(): ()
|
function Signal:DisconnectAll(): ()
|
||||||
|
for _, handle in self do
|
||||||
|
handle:Disconnect()
|
||||||
|
end
|
||||||
table.clear(self)
|
table.clear(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -84,6 +88,12 @@ end
|
||||||
|
|
||||||
function Signal:Destroy(): ()
|
function Signal:Destroy(): ()
|
||||||
self:DisconnectAll()
|
self:DisconnectAll()
|
||||||
|
for idx: string, signal in Signals do
|
||||||
|
if self :: any == signal then
|
||||||
|
Signals[idx] = nil
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
setmetatable(self, nil)
|
setmetatable(self, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue