actboy168 / YDWE

A Tool to Help the Creation of Warcraft III Map
GNU General Public License v3.0
463 stars 139 forks source link

lua引擎 又一个新的崩溃bug #200

Open w4454962 opened 3 years ago

w4454962 commented 3 years ago

代码如下 测试版本 ydwe1.32.13 疯狂按esc即可闪退

local console = require 'jass.console'
local runtime = require 'jass.runtime'
local jass = require 'jass.common'
console.enable = true 
print = console.write 

function test()
    local trg = jass.CreateTrigger()
    jass.TriggerRegisterPlayerEvent(trg, jass.Player(0), jass.EVENT_PLAYER_END_CINEMATIC)
    jass.TriggerAddAction(trg, function ()
        print("ESC", coroutine.running())
    end)
end 

local co = coroutine.create(test)
coroutine.resume(co)

runtime.sleep = true

大概 runtime.sleep 无论什么情况下都要置顶 否则会发生崩溃 提交到这里警示一下其他人注意一下吧

崩溃的原因是 触发器所在的子线程被回收 之后再次回调时是野指针产生的崩溃