Skip to content

Commit

Permalink
Fix hang when connecting to an Event during its invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
hoontee committed Nov 12, 2024
1 parent 4078f4d commit 65dcffc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Pronghorn/New.luau
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function New.Event(): Event<...any>
Fire = function(_self: Event<...any>, ...: any): ()
local currentlyWaiting = table.clone(waiting)
table.clear(waiting)
for _, callback in callbacks do
for _, callback in table.clone(callbacks) do
task.spawn(callback, ...)
end
for _, callback in currentlyWaiting do
Expand Down Expand Up @@ -268,7 +268,7 @@ function New.QueuedEvent(nameHint: string?): Event<...any>
else
local currentlyWaiting = table.clone(waiting)
table.clear(waiting)
for _, callback in callbacks do
for _, callback in table.clone(callbacks) do
task.spawn(callback, ...)
end
for _, callback in currentlyWaiting do
Expand Down Expand Up @@ -350,7 +350,7 @@ function New.TrackedVariable(variable: any): TrackedVariable<any>
variable = newValue
local currentlyWaiting = table.clone(waiting)
table.clear(waiting)
for _, callback in callbacks do
for _, callback in table.clone(callbacks) do
task.spawn(callback, oldValue, newValue)
end
for _, callback in currentlyWaiting do
Expand Down
2 changes: 1 addition & 1 deletion Pronghorn/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
║ ██████▀██▓▌▀▌ ▄ ▄▓▌▐▓█▌ ║
║ ║
║ ║
║ Pronghorn Framework Rev. B75
║ Pronghorn Framework Rev. B76
║ https://github.com/Iron-Stag-Games/Pronghorn ║
║ GNU Lesser General Public License v2.1 ║
║ ║
Expand Down

0 comments on commit 65dcffc

Please sign in to comment.