Skip to content

Reloading lua with a orphaned lua UI element causes crash

To replicate in the console:

luap
ui.create({})
exit()
reloadlua

My debugger says this is the culprit. I am not familiar enough with the UI system to fix this.

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xbeaddb7ca840)
    frame #0: 0x0000000102beb410 openmw`LuaUi::(anonymous namespace)::destroyWidget(ext=0x0000beaddb7ca840) at element.cpp:48:18
   45  	
   46  	        void destroyWidget(LuaUi::WidgetExtension* ext)
   47  	        {
-> 48  	            ext->deinitialize();
   49  	            MyGUI::Gui::getInstancePtr()->destroyWidget(ext->widget());
   50  	        }

If you do whatever = ui.create({}), then the game will not crash.

This should not be a problem for finished mods, but can make developing/learning UI mods difficult, if a UI element is not properly disposed of before its variable is set to nil.

Edited by Daisyhasacat