Pretty sure a mod UI isn't supposed to cause a CTD. Not sure how I triggered it exactly, smart trains mod wasn't closed properly perhaps when exiting the train GUI? The error seems to have come from the destructor of a GUI element, perhaps it's a race condition?
Log file attached, it appears to have a pretty complete symbol dump..
[0.12.7] CTD with a mod UI
[0.12.7] CTD with a mod UI
- Attachments
-
- factorio-current.log
- (9.59 KiB) Downloaded 190 times
Re: [0.12.7] CTD with a mod UI
Do you have the save and mods? Also a best-guess as to how you caused it would help.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.12.7] CTD with a mod UI
It wasn't repeatable, so far. The mod was most likely the "Smart Trains" mod - I noticed that the UI elements it spawned somehow lingered after closing the main train window. The way the error occured seems to be related to interacting with the smart trains GUI. No doubt there's a bug in smart trains, but I would anticipate the sandbox should try and prevent a mod from causing a CTD.
SmartTrains: https://forums.factorio.com/forum/vie ... 97&t=14432 (I have 0.3.66 installed locally at present).
You can see the complete mod list in the log file, but the activity was around configuring a train line in SmartTrains, and then trying to exit the train GUI.
SmartTrains: https://forums.factorio.com/forum/vie ... 97&t=14432 (I have 0.3.66 installed locally at present).
You can see the complete mod list in the log file, but the activity was around configuring a train line in SmartTrains, and then trying to exit the train GUI.
Re: [0.12.7] CTD with a mod UI
In case it helps, some probably relevant parts of the code: (starts at ~ line 672 in control.lua )cpw wrote:The mod was most likely the "Smart Trains" mod - I noticed that the UI elements it spawned somehow lingered after closing the main train window. The way the error occured seems to be related to interacting with the smart trains GUI. No doubt there's a bug in smart trains, but I would anticipate the sandbox should try and prevent a mod from causing a CTD.
Code: Select all
function ontick(event)
--snip
if event.tick%10==9 then
local status,err = pcall(
function()
for pi, player in pairs(game.players) do
if player.opened ~= nil and not global.player_opened[player.name] then
game.raise_event(events["on_player_opened"], {entity=player.opened, player_index=pi})
global.player_opened[player.name] = player.opened
end
if global.player_opened[player.name] and player.opened == nil then
game.raise_event(events["on_player_closed"], {entity=global.player_opened[player.name], player_index=pi})
global.player_opened[player.name] = nil
end
end
end
)
if not status then
pauseError(err, "on_tick_players")
end
end
end
function on_player_opened(event)
if event.entity.valid and game.players[event.player_index].valid then
if event.entity.type == "locomotive" and event.entity.train then
global.playerPage[event.player_index] = {schedule=1,lines=1}
local name = event.entity.backer_name or event.entity.name
local trainInfo = getTrainFromEntity(event.entity)
removeInvalidTrains(true)
GUI.create_or_update(trainInfo, event.player_index)
global.guiData[event.player_index] = {rules={}}
global.openedTrain[event.player_index] = event.entity.train
elseif event.entity.type == "train-stop" then
global.playerPage[event.player_index] = {schedule=1,lines=1}
GUI.create_or_update(false, event.player_index)
global.guiData[event.player_index] = {rules={}}
global.openedName[event.player_index] = event.entity.backer_name
end
end
end
function on_player_closed(event)
if event.entity.valid and game.players[event.player_index].valid then
if event.entity.type == "locomotive" and event.entity.train then
local name = event.entity.backer_name or event.entity.name
GUI.destroy(event.player_index)
global.guiData[event.player_index] = nil
global.openedTrain[event.player_index] = nil
--set line version to -1, so it gets updated at the next station
local train = getTrainFromEntity(event.entity)
if train.line and train.lineVersion ~= 0 then
train.lineVersion = -1
end
elseif event.entity.type == "train-stop" then
GUI.destroy(event.player_index)
global.guiData[event.player_index] = nil
if event.entity.backer_name ~= global.openedName[event.player_index] then
on_station_rename(event.entity, global.openedName[event.player_index])
end
end
end
end
GUI.destroy looks like (GUI.lua, ~ line 50)
Code: Select all
destroyGui = function (guiA)
if guiA ~= nil and guiA.valid then
guiA.destroy()
end
end,
destroy = function(player_index)
local player = false
if type(player_index) == "number" then
player = game.players[player_index]
else
player = player_index
end
if player.valid then
GUI.destroyGui(player.gui[GUI.position][GUI.windows.root])
end
end,
I probably should/could pcall on_player_closed/opened
Re: [0.12.7] CTD with a mod UI
Yes, nil checks when destroying gui elements are on place. This particular error looks like some other problem, I will try to investigate.
Re: [0.12.7] CTD with a mod UI
And yes, it was internal agui issue that is now fixed for 0.12.8