Skip to content

Lua UI crash on creating nested UI elements twice without destroying old parent element

Happens in 0.49 and 0.50 RC2.

How to reproduce:

local ui = require('openmw.ui')
local item_1 = ui.create { type = ui.TYPE.Widget }
local item_2 = ui.create { type = ui.TYPE.Widget }

return {
    engineHandlers = {
        onKeyPress = function(e)
            if e.symbol == 'z' then
                ui.create {
                    type = ui.TYPE.Widget,
                    content = ui.content {
                        item_1,
                        item_2
                    }
                }
            end
        end,
    },
}

After pressing z twice the game crashes:

*** Fatal Error ***
Address not mapped to object (signal 11)
Address: 0x7ffe5771bff8