Page 1 of 1
crash
Posted: 09 Feb 2008, 07:56
by aragon
every time i do /luaui reload, my spring crashes (tested on singleplayer)
Core 2 Duo 2.4
1.5GB ram
GeForce 7600GS
i removed all widgets from LuaUI/widgets and it still crashes
it happens only with BA6.1 (so, it is also BA bug, but it should not crash spring probably, just luaui)
here is infolog:
http://pastebin.com/f7bc4e9c9
Re: crash
Posted: 10 Feb 2008, 17:47
by NOiZE
Seems to happen for me too, it seems its related to the BA layout widget, which lurker made, maybe lurker can take a look?
Re: crash
Posted: 10 Feb 2008, 22:09
by lurker
Is your luaui/main.lua 4332 bytes?
Re: crash
Posted: 10 Feb 2008, 22:39
by NOiZE
lurker wrote:Is your luaui/main.lua 4332 bytes?
yes
Re: crash
Posted: 10 Feb 2008, 22:41
by lurker
not you >_>
Re: crash
Posted: 10 Feb 2008, 22:48
by NOiZE
i get the same crash.... when i do /luaui reload with BA61 and my infolog says the same then.
Re: crash
Posted: 10 Feb 2008, 22:53
by eriatarka
I fed it to the stacktrace translator:
http://pastebin.com/m5da1ce0d
EDIT: From the length and structure of this thing, I'd say a stack overflow from some infinite recursion.
Re: crash
Posted: 10 Feb 2008, 23:36
by lurker
NOiZE wrote:i get the same crash.... when i do /luaui reload with BA61 and my infolog says the same then.
Do you also get the:
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
LuaUI::RunCallIn: error = 2, LayoutButtons, [string "LuaUI/layout.lua"]:113: attempt to perform arithmetic on global 'activePage' (a nil value)
Re: crash
Posted: 11 Feb 2008, 00:00
by NOiZE
yes
Re: crash
Posted: 11 Feb 2008, 01:37
by aragon
yes, my main.lua is exactly 4332 bytes long
Re: crash
Posted: 12 Feb 2008, 02:28
by eriatarka
I've finally tracked down this elusive little bugger (BTW with the help of the Lua trace script I posted in the Lua section, very helpful).
It's a bit complicated, so bear with me. What happens when the UI is reloaded is this:
- The Lua context is torn down and re-initialized from scratch.
- The LuaUI widget manager initializes itself and runs each widget's Initialize method.
- The BA Layout widget's Initialize method invokes the console command "/ctrlpanel" with the mod's custom ctrlpanel.txt, which in turn calls CGuiHandler::ReloadConfig.
- ReloadConfig calls LayoutIcons, which eventually does a Lua callin for LayoutButtons.
- At this point, the BA widget hasn't yet registered its LayoutButtons replacement function, so the default LuaUI handler is called.
- This handler, DefaultHandler in layout.lua, tries to access the global variable activePage, which hasn't been set at this point. We get an error.
- The callin function catches the error and tries to shutdown LuaUI.
- LuaUI calls each widget's Shutdown method.
- The BA layout widget, in its Shutdown method, again issues a /ctrlpanel command to reset to default settings. Back to step 4.
And there you have it, infinite recursion with an eventual stack overflow. So, it's a LuaUI bug and not Lurker's fault.
The fix is easy, a one-liner in fact: change layout.lua to read
Code: Select all
if (xIcons > 2) then
local color
if (commands[1].id < 0) then color = GreenStr else color = RedStr end
local activePage = activePage or 0 -- <- this is the line to be added --
local pageNum = '' .. (activePage + 1) .. ''
PageNumCmd.name = color .. ' ' .. pageNum .. ' '
table.insert(customCmds, PageNumCmd)
pageNumCmd = cmdCount + 1
end
Unfortunately I don't have SVN access.
Re: crash
Posted: 12 Feb 2008, 02:46
by Kloot
Thanks for the nice detective work, it's committed.
Re: crash
Posted: 12 Feb 2008, 02:48
by LordMatt
Did you verify that this bug/fix works with the latest SVN version? If so, I can commit this for you.
Re: crash
Posted: 12 Feb 2008, 17:59
by NOiZE
so i assume i need to add that in the BA layout widget as well?
Re: crash
Posted: 12 Feb 2008, 20:48
by eriatarka
NOiZE wrote:so i assume i need to add that in the BA layout widget as well?
It's not really necessary; as I said, the custom handler hasn't been installed at the time the crash occurs. However it's certainly not bad practice.
Re: crash
Posted: 11 Mar 2008, 23:27
by Acidd_UK
MASSIVE Thankyou for fixing this - this problem has been plaguing me since the release!