[0.16.51] Lua access violation crash
Posted: Fri Oct 19, 2018 7:06 am
Hey, I ran into this crash developing a mod.
Steps to reproduce:
1. Run these three commands in succession
2. Game will crash on the third one (100% success rate for me)
I don't think the game should crash here. Maybe if the reference to sf wasn't captured in a closure it'd make more sense. Looks like there's bug when accessing a cached member of a game object. This is reproducible with game.players[1].force.is_chunk_charted too, but its likely not limited to a particular method.
Steps to reproduce:
1. Run these three commands in succession
2. Game will crash on the third one (100% success rate for me)
Code: Select all
/c
function func()
local sf = game.surfaces[1]
local find_entities_filtered = sf.find_entities_filtered
local find_entities_filtered_area = { {-10,-10}, {10,10} }
local find_entities_filtered_params = { type = types, area = find_entities_filtered_area }
local function fn()
return find_entities_filtered(find_entities_filtered_params)
end
return fn
end
Code: Select all
/c f = func()
Code: Select all
/c
local N = 100000
for i = 1, N do
f()
end