Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core dump attempting to use wesnoth.print_attributes on stacked_widget #8807

Open
white-haired-uncle opened this issue Apr 26, 2024 · 2 comments
Labels
Bug Issues involving unexpected behavior. Lua API Issues with the Lua engine and API. UI User interface issues, including both back-end and front-end issues.

Comments

@white-haired-uncle
Copy link
Contributor

Game and System Information

  • Version:
    Battle for Wesnoth v1.19.0-dev (ebe84ce5e68-Modified) <unknown>

  • OS:
    Linux spartan 5.15.0-97-generic #107-Ubuntu SMP Wed Feb 7 13:26:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Description of the bug

wesnoth: src/gui/auxiliary/iterator/policy_order.hpp:266: bool gui2::iteration::policy::order::top_down<VW, VG, VC>::next() [with bool VW = true; bool VG = true; bool VC = true]: Assertion `root_' failed.
Abort(coredump)

On a forum post I saw mention of a stacked_widget which I thought might help me with a problem, but seems to have no documentation I can find. So I thought I'd see if I could weasel some clues out of wesnoth.print_attributes(). It didn't work, and I'm not at all surprised since I have absolutely no idea what I'm doing, but I crashed wesnoth so here I am.

function wesnoth.wml_actions.stacked_widget_gui()
        local dialogDefinition = {
                wml.tag.tooltip { id = "tooltip_large" },
                wml.tag.helptip { id = "helptip_large" },
                wml.tag.grid {  wml.tag.row { wml.tag.column {
                        wml.tag.stacked_widget {
                                id = "stacker",
                                T.layer {
                                        T.row { T.column { T.label { label = "Hello world" } } }
                                }
                        }
                } } }
        }

        local function preshow(dialog)
                wesnoth.print_attributes(dialog.stacker)
                gui.show_lua_console()
        end
        gui.show_dialog(dialogDefinition,preshow)
end

Steps to reproduce the behavior

  1. Install attached scenario.
  2. Use right click menu "stacked_widget_gui"

GUI_Tutorial.tar.gz

Expected behavior

An error message with some idea of the (first) error would be preferable.

Additional context

Please change the title to something useful. I have no idea what it would be at this point, but didn't want to just put "core dump".

@white-haired-uncle white-haired-uncle added the Bug Issues involving unexpected behavior. label Apr 26, 2024
@white-haired-uncle white-haired-uncle changed the title Core dump attempting to use gui stacked_widget Core dump attempting to use wesnoth.print_attributes on stacked_widget Apr 26, 2024
@white-haired-uncle
Copy link
Contributor Author

Okay, figured out one thing. If I comment out wesnoth.print_attributes(dialog.stacker) it runs and I see "Hello world" displayed.

I also added an id to the label and ran wesnoth.print_attributes(dialog.my_label) and got something that looks more or less correct (to the best of my understanding).

@CelticMinstrel
Copy link
Member

Got a stack trace. This is the relevant portion.

#4	0x00000001003bb55d in gui2::iteration::policy::order::top_down<true, true, true>::next() at wesnoth/src/gui/auxiliary/iterator/policy_order.hpp:266
#5	0x0000000100351628 in gui2::iteration::iterator<gui2::iteration::policy::order::top_down<true, true, true> >::next() at wesnoth/src/gui/auxiliary/iterator/iterator.hpp:77
#6	0x0000000100351049 in lua_widget::impl_widget_dir(lua_State*) at wesnoth/src/scripting/lua_widget_attributes.cpp:605
#7	0x0000000102889de7 in precallC(lua_State*, StackValue*, int, int (*)(lua_State*)) at wesnoth/src/modules/lua/ldo.c:529
#8	0x0000000102889ea2 in luaD_precall(lua_State*, StackValue*, int) at wesnoth/src/modules/lua/ldo.c:595
#9	0x000000010288a1d5 in ccall(lua_State*, StackValue*, int, unsigned int) at wesnoth/src/modules/lua/ldo.c:635
#10	0x000000010288a248 in luaD_callnoyield(lua_State*, StackValue*, int) at wesnoth/src/modules/lua/ldo.c:655
#11	0x0000000102879c8f in f_call(lua_State*, void*) at wesnoth/src/modules/lua/lapi.c:1038
#12	0x00000001028888b1 in luaD_rawrunprotected(lua_State*, void (*)(lua_State*, void*), void*) at wesnoth/src/modules/lua/ldo.c:144
#13	0x000000010288a923 in luaD_pcall(lua_State*, void (*)(lua_State*, void*), void*, long, long) at wesnoth/src/modules/lua/ldo.c:953
#14	0x0000000102879b56 in lua_pcallk(lua_State*, int, int, int, long, int (*)(lua_State*, int, long)) at wesnoth/src/modules/lua/lapi.c:1064
#15	0x000000010148e96e in dir_meta_helper(lua_State*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) at wesnoth/src/scripting/lua_kernel_base.cpp:536
#16	0x000000010148e629 in luaW_get_attributes(lua_State*, int) at wesnoth/src/scripting/lua_kernel_base.cpp:632

In short, iterating through a stacked widget is broken for some reason. It might be as simple as "someone forgot to implement the visitor methods" but I haven't looked any closer at it.

@Wedge009 Wedge009 added UI User interface issues, including both back-end and front-end issues. Lua API Issues with the Lua engine and API. labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues involving unexpected behavior. Lua API Issues with the Lua engine and API. UI User interface issues, including both back-end and front-end issues.
Projects
None yet
Development

No branches or pull requests

3 participants