Skip to content

Commit

Permalink
[Fix] Don't kill thread OnClose
Browse files Browse the repository at this point in the history
  • Loading branch information
ThymonA committed Nov 30, 2020
1 parent 44bdf01 commit f79538c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions app/lua_components/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,17 +326,21 @@ function CreateMenu(info)
for _, v in pairs(t.Events[event]) do
if (type(v) == 'table' and U:Typeof(v.func) == 'function') then
CreateThread(function()
local threadId = coroutine.running()
if (event == 'OnClose') then
v.func(t, unpack(args))
else
local threadId = coroutine.running()

if (threadId ~= nil) then
insert(t.data.Threads, threadId)
if (threadId ~= nil) then
insert(t.data.Threads, threadId)

v.func(t, unpack(args))
v.func(t, unpack(args))

for i = 0, #(t.data.Threads or {}), 1 do
if (t.data.Threads[i] == threadId) then
remove(t.data.Threads, i)
return
for i = 0, #(t.data.Threads or {}), 1 do
if (t.data.Threads[i] == threadId) then
remove(t.data.Threads, i)
return
end
end
end
end
Expand Down

0 comments on commit f79538c

Please sign in to comment.