Crash when reading "A Beginner's Guide to Magic" with Magiclysm enabled.
Crash when reading "A Beginner's Guide to Magic" with Magiclysm
This is on Linux with cataclysm-tiles using version: cdda-experimental-2024-12-03-0845-7e0339c1be
Steps to reproduce:
Create a world with Magiclysm enabled.
Create a character with The Last Mage Scenario
Once the scenario loads, (R)ead "A Beginner's Guide to Magic"
This should result in the following crash:
cataclysm-tiles: src/third-party/imgui/imgui.cpp:5956: bool ImGui::BeginChildEx(const char*, ImGuiID, const ImVec2&, ImGuiChildFlags, ImGuiWindowFlags): Assertion(window_flags & ImGuiWindowFlags_AlwaysAutoResize) == 0 && "Cannot specify ImGuiWindowFlags_AlwaysAutoResize for BeginChild(). Use ImGuiChildFlags_AlwaysAutoResize!"' failed.
`
Attach save file
Steps to reproduce
Create a world with Magiclysm enabled. Create a character with The Last Mage Scenario Once the scenario loads, (R)ead "A Beginner's Guide to Magic"
Expected behavior
A popup of spells to learn
Screenshots
No response
Versions and configuration
- OS: Linux
- OS Version: LSB Version: n/a; Distributor ID: Gentoo; Description: Gentoo Linux; Release: 2.17; Codename: n/a;
- Game Version: cdda-experimental-2024-12-03-0845 7e0339c1be-dirty [64-bit]
- Graphics Version: Tiles
- Game Language: English [en]
- Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], Portal Storms Ignore NPCs [personal_portal_storms], Slowdown Fungal Growth [no_fungal_growth], Magiclysm [magiclysm], Alternative Map Key [alt_map_key], Bombastic Perks [bombastic_perks], Stats Through Kills [stats_through_kills], Stats Through Skills [StatsThroughSkills] ]
Additional context
No response
It appears changing src/magic.cpp lines 3197 and 3198 from
if( ImGui::BeginChild( "spellbook info", info_size, false, ImGuiWindowFlags_AlwaysAutoResize ) )
to
if( ImGui::BeginChild( "spellbook info", info_size, ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY | ImGuiChildFlags_AlwaysAutoResize, false) )
fixes the crash. I have no idea if this is the intended functionality or not.
Does it crash if you read other magic-teaching books or just this one?
Other magic books I've found are affected. I initially located the bug with a druid, but I failed to preserve the save file.
I have a stack trace from a debugger using RELEASE=0 with make if it helps:
(gdb) run Starting program: /home/wo/projects/games/Cataclysm-DDA/cataclysm-tiles [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib64/libthread_db.so.1". [New Thread 0x7ffff637c6c0 (LWP 767481)] [New Thread 0x7fffe9a776c0 (LWP 767488)] [New Thread 0x7fffe92766c0 (LWP 767489)] [New Thread 0x7fffe92356c0 (LWP 767490)] cataclysm-tiles: src/third-party/imgui/imgui.cpp:5956: bool ImGui::BeginChildEx(const char*, ImGuiID, const ImVec2&, ImGuiChildFlags, ImGuiWindowFlags): Assertion (window_flags & ImGuiWindowFlags_AlwaysAutoResize) == 0 && "Cannot specify ImGuiWindowFlags_AlwaysAutoResize for BeginChild(). Use ImGuiChildFlags_AlwaysAutoResize!"' failed.
Thread 1 "cataclysm-tiles" received signal SIGABRT, Aborted.
0x00007ffff77d2c0c in ?? () from /usr/lib64/libc.so.6
(gdb) bt
#0 0x00007ffff77d2c0c in ?? () from /usr/lib64/libc.so.6
#1 0x00007ffff777d576 in raise () from /usr/lib64/libc.so.6
#2 0x00007ffff77658fa in abort () from /usr/lib64/libc.so.6
#3 0x00007ffff776581e in ?? () from /usr/lib64/libc.so.6
#4 0x00007ffff7775b76 in __assert_fail () from /usr/lib64/libc.so.6
#5 0x00005555579168bb in ImGui::BeginChildEx (name=name@entry=0x555557c83632 "spellbook info", id=3583925678, size_arg=..., child_flags=child_flags@entry=0, window_flags=window_flags@entry=64) at src/third-party/imgui/imgui.cpp:5956
#6 0x0000555557916a72 in ImGui::BeginChild (str_id=str_id@entry=0x555557c83632 "spellbook info", size_arg=..., child_flags=child_flags@entry=0, window_flags=window_flags@entry=64) at src/third-party/imgui/imgui.cpp:5938
#7 0x0000555556f1ea6b in spellbook_callback::refresh (this=0x7fffffffb4f0, menu=0x7fffffffb770) at src/magic.cpp:3197
#8 0x00005555579e5b85 in uilist_impl::draw_controls (this=0x55557ffa8e90) at src/ui.cpp:198
#9 0x000055555663b301 in cataimgui::window::draw (this=0x55557ffa8e90) at src/cata_imgui.cpp:933
#10 0x000055555663f79d in cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}::operator()(ui_adaptor&) const (__closure=<optimized out>) at src/cata_imgui.cpp:808
#11 std::__invoke_impl<void, cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}&, ui_adaptor&>(std::__invoke_other, cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}&, ui_adaptor&) (__f=...)
at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:61
#12 std::__invoke_r<void, cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}&, ui_adaptor&>(cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}&, ui_adaptor&) (__fn=...)
at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:111
#13 std::_Function_handler<void (ui_adaptor&), cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}>::_M_invoke(std::_Any_data const&, ui_adaptor&) (__functor=..., __args#0=...)
at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:290
#14 0x00005555579f4b14 in std::function<void(ui_adaptor&)>::operator() (this=this@entry=0x555580a38fd8, __args#0=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:591
#15 0x00005555579f458f in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:448
#16 0x00005555579f46ec in ui_adaptor::redraw () at src/ui_manager.cpp:353
#17 0x00005555579f4749 in ui_manager::redraw () at src/ui_manager.cpp:516
#18 0x00005555579e5260 in uilist::query (this=this@entry=0x7fffffffb770, loop=loop@entry=true, timeout=timeout@entry=50, allow_unfiltered_hotkeys=allow_unfiltered_hotkeys@entry=false) at src/ui.cpp:989
#19 0x0000555556e9f92b in learn_spell_actor::use (this=0x555561ffb590, p=0x55555f7605e0) at src/iuse_actor.cpp:2437
#20 0x0000555556e10645 in use_function::call (this=this@entry=0x555561ffb580, p=p@entry=0x55555f7605e0, it=..., pos=...) at src/iuse.cpp:9402
#21 0x0000555556bb9407 in read () at src/handle_action.cpp:1718
#22 0x0000555556bba396 in game::do_regular_action (this=this@entry=0x55555f76a500, act=@0x7fffffffcd38: ACTION_READ, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2582
#23 0x0000555556bbccd0 in game::handle_action (this=0x55555f76a500) at src/handle_action.cpp:3278
#24 0x0000555556985b0c in do_turn () at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/unique_ptr.h:193
#25 0x0000555556f763c5 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:863
Can confirm issue with both Magiclysm and Xedra Evolved items that teach spells from activation. With regards to fix from Hourousha, what worked for me was ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY (crashes on inclusion of ImGuiChildFlags_AlwaysAutoResize).
src/magic.cpp was modified as of version cdda-experimental-2024-12-11-2206 651881e30d
Unfortunately, the issue persists, but the stack trace is different:
cataclysm-tiles: src/third-party/imgui/imgui.cpp:5956: bool ImGui::BeginChildEx(const char*, ImGuiID, const ImVec2&, ImGuiChildFlags, ImGuiWindowFlags): Assertion (window_flags & ImGuiWindowFlags_AlwaysAutoResize) == 0 && "Cannot specify ImGuiWindowFlags_AlwaysAutoResize for BeginChild(). Use ImGuiChildFlags_AlwaysAutoResize!" failed.
Thread 1 "cataclysm-tiles" received signal SIGABRT, Aborted.
0x00007ffff77d1c0c in ?? () from /usr/lib64/libc.so.6
(gdb) bt
#0 0x00007ffff77d1c0c in ?? () from /usr/lib64/libc.so.6
#1 0x00007ffff777c576 in raise () from /usr/lib64/libc.so.6
#2 0x00007ffff77648fa in abort () from /usr/lib64/libc.so.6
#3 0x00007ffff776481e in ?? () from /usr/lib64/libc.so.6
#4 0x00007ffff7774b76 in __assert_fail () from /usr/lib64/libc.so.6
#5 0x000055555792a6bb in ImGui::BeginChildEx (name=name@entry=0x555557c97aa0 "spellbook info", id=1016432338, size_arg=..., child_flags=child_flags@entry=0, window_flags=window_flags@entry=64) at src/third-party/imgui/imgui.cpp:5956
#6 0x000055555792a872 in ImGui::BeginChild (str_id=str_id@entry=0x555557c97aa0 "spellbook info", size_arg=..., child_flags=child_flags@entry=0, window_flags=window_flags@entry=64) at src/third-party/imgui/imgui.cpp:5938
#7 0x0000555556f2f017 in spellbook_callback::refresh (this=0x7fffffffb560, menu=0x7fffffffb7e0) at src/magic.cpp:3197
#8 0x00005555579f9293 in uilist_impl::draw_controls (this=0x5555ad6a6d10) at src/ui.cpp:198
#9 0x0000555556644841 in cataimgui::window::draw (this=0x5555ad6a6d10) at src/cata_imgui.cpp:934
#10 0x0000555556648dc9 in cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}::operator()(ui_adaptor&) const (__closure=<optimized out>) at src/cata_imgui.cpp:809
#11 std::__invoke_impl<void, cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}&, ui_adaptor&>(std::__invoke_other, cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}&, ui_adaptor&) (__f=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:61
#12 std::__invoke_r<void, cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}&, ui_adaptor&>(cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}&, ui_adaptor&) (__fn=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:111
#13 std::_Function_handler<void (ui_adaptor&), cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}>::_M_invoke(std::_Any_data const&, ui_adaptor&) (__functor=..., __args#0=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:290
#14 0x0000555557a08354 in std::function<void(ui_adaptor&)>::operator() (this=this@entry=0x5555ae4956f8, __args#0=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:591
#15 0x0000555557a07dcf in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:448
#16 0x0000555557a07f2c in ui_adaptor::redraw () at src/ui_manager.cpp:353
#17 0x0000555557a07f89 in ui_manager::redraw () at src/ui_manager.cpp:516
#18 0x00005555579f896e in uilist::query (this=this@entry=0x7fffffffb7e0, loop=loop@entry=true, timeout=timeout@entry=50, allow_unfiltered_hotkeys=allow_unfiltered_hotkeys@entry=false) at src/ui.cpp:942
#19 0x0000555556eafb4b in learn_spell_actor::use (this=0x55556bfab470, p=0x55555f78dac0) at src/iuse_actor.cpp:2445
#20 0x0000555556e2066d in use_function::call (this=this@entry=0x55556bfab460, p=p@entry=0x55555f78dac0, it=..., pos=...) at src/iuse.cpp:9402
#21 0x0000555556bc5647 in read () at src/handle_action.cpp:1718
#22 0x0000555556bc65f1 in game::do_regular_action (this=this@entry=0x55555f622b30, act=@0x7fffffffcda8: ACTION_READ, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2582
#23 0x0000555556bc8f2c in game::handle_action (this=0x55555f622b30) at src/handle_action.cpp:3279
#24 0x000055555698f84c in do_turn () at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/unique_ptr.h:193
#25 0x0000555556f86985 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:863
can confirm that the error still exists, have tested it with over a dozen different books/scrolls adding crash log and the save i was testing with for others to hopefully be able to parse
Fixed by #78652.
Confirmed this works in Magiclysm.