CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.11k stars 4.11k forks source link

assertion failure in draw_controls in achievement popups #72973

Closed l29ah closed 3 days ago

l29ah commented 4 months ago

Describe the bug

(gdb) bt
#0  0x00007f8bf22a003c in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007f8bf2250296 in raise () from /lib64/libc.so.6
#2  0x00007f8bf22388b7 in abort () from /lib64/libc.so.6
#3  0x00005561c2a72099 in signal_handler (sig=<optimized out>) at src/crash.cpp:147
#4  signal_handler (sig=<optimized out>) at src/crash.cpp:108
#5  <signal handler called>
#6  0x00007f8bf22a003c in __pthread_kill_implementation () from /lib64/libc.so.6
#7  0x00007f8bf2250296 in raise () from /lib64/libc.so.6
#8  0x00007f8bf22388b7 in abort () from /lib64/libc.so.6
#9  0x00007f8bf24d9bdf in std::__glibcxx_assert_fail (file=file@entry=0x5561c4294390 "/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/array", line=line@entry=202, 
    function=function@entry=0x5561c42a8d60 "constexpr std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](size_type) [with _Tp = RGBTuple; long unsigned int _Nm = 16; reference = RGBTuple&; size_type = long unsigned int]", 
    condition=condition@entry=0x5561c4239a4a "__n < this->size()") at /var/tmp/portage/sys-devel/gcc-13.2.1_p20240210/work/gcc-13-20240210/libstdc++-v3/src/c++11/assert_fail.cc:41
#10 0x00005561c27b4cdf in std::array<RGBTuple, 16ul>::operator[] (this=0x5561c4ab7ae0 <rgbPalette>, __n=237) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/array:200
#11 std::array<RGBTuple, 16ul>::operator[] (__n=237, this=0x5561c4ab7ae0 <rgbPalette>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/array:200
#12 cataimgui::window::draw_colored_text (this=this@entry=0x5561fe131c60, text="<color_c_dark_gray>Achievement completion popups can be</color>", color=..., wrap_width=<optimized out>, is_selected=is_selected@entry=0x0, 
    is_focused=is_focused@entry=0x0, is_hovered=is_hovered@entry=0x0) at src/cata_imgui.cpp:408
#13 0x00005561c3bc65b3 in query_popup_impl::draw_controls (this=0x5561fe131c60) at src/popup.cpp:56
#14 0x00005561c27b2fea in cataimgui::window::draw (this=0x5561fe131c60) at src/cata_imgui.cpp:579
#15 0x00005561c27b66d1 in cataimgui::window::draw (this=<optimized out>) at src/cata_imgui.cpp:554
#16 cataimgui::window_impl::window_impl(cataimgui::window*)::{lambda(ui_adaptor&)#1}::operator()(ui_adaptor&) const (__closure=<optimized out>) at src/cata_imgui.cpp:450
#17 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/13/include/g++-v13/bits/invoke.h:61
#18 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/13/include/g++-v13/bits/invoke.h:111
#19 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/13/include/g++-v13/bits/std_function.h:290
#20 0x00005561c40245c8 in std::function<void (ui_adaptor&)>::operator()(ui_adaptor&) const (__args#0=..., this=0x556206a2d5f8) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:591
#21 ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
#22 0x00005561c40248f1 in ui_adaptor::redraw () at src/ui_manager.cpp:345
#23 0x00005561c3bc7ecd in query_popup::query_once (this=this@entry=0x7ffd6abe4530) at src/popup.cpp:285
#24 0x00005561c3bc96ff in query_popup::query (this=this@entry=0x7ffd6abe4530) at src/popup.cpp:397
#25 0x00005561c3a43eb5 in popup (
    text="<color_c_light_green>Achievement completed!</color>\n\n<color_c_light_green>Zombie PD, to protect and zombify!</color>\n  <color_c_light_green>Completed Year 1, Spring, day 78 04:17:31</color>\n  <color_c"..., 
    flags=flags@entry=PF_NONE) at src/output.cpp:950
#26 0x00005561c2dc2f93 in achievement_attained (a=0x5561c742c8b8, achievements_enabled=<optimized out>) at src/game.cpp:416
#27 0x00005561c24aa0d9 in std::function<void (achievement const*, bool)>::operator()(achievement const*, bool) const (__args#1=<optimized out>, __args#0=0x5561c742c8b8, this=0x5561c6a97e50)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:591
#28 achievements_tracker::report_achievement (this=0x5561c6a97e30, a=0x5561c742c8b8, comp=achievement_completion::completed) at src/achievement.cpp:803
#29 0x00005561c3e4113e in watcher_set<stat_watcher>::send_to_all<stat_watcher, cata_variant const&, stats_tracker&, cata_variant const&, stats_tracker&> (mem_fn=&virtual table offset 16, this=<optimized out>) at src/stats_tracker.h:161
#30 stats_tracker::stat_value_changed (this=0x5561c6a96340, id=..., new_value=...) at src/stats_tracker.cpp:322
#31 0x00005561c3e4105e in watcher_set<event_multiset_watcher>::send_to_all<event_multiset_watcher, cata::event const&, stats_tracker&, cata::event const&, stats_tracker&> (mem_fn=&virtual table offset 16, this=0x5561f4fa6728)
    at src/stats_tracker.h:161
#32 stats_tracker::transformed_set_changed (this=0x5561c6a96340, id=..., new_element=...) at src/stats_tracker.cpp:304
#33 0x00005561c2c745ff in non-virtual thunk to event_transformation_impl::state::event_added(cata::event const&, stats_tracker&) () at src/event_statistics.cpp:469
#34 0x00005561c3e4105e in watcher_set<event_multiset_watcher>::send_to_all<event_multiset_watcher, cata::event const&, stats_tracker&, cata::event const&, stats_tracker&> (mem_fn=&virtual table offset 16, this=0x5561f4fc6678)
    at src/stats_tracker.h:161
#35 stats_tracker::transformed_set_changed (this=0x5561c6a96340, id=..., new_element=...) at src/stats_tracker.cpp:304
#36 0x00005561c2c745ff in non-virtual thunk to event_transformation_impl::state::event_added(cata::event const&, stats_tracker&) () at src/event_statistics.cpp:469
#37 0x00005561c3e4361e in watcher_set<event_multiset_watcher>::send_to_all<event_multiset_watcher, cata::event const&, stats_tracker&, cata::event const&, stats_tracker&> (mem_fn=&virtual table offset 16, this=<optimized out>)
    at src/stats_tracker.h:161
#38 stats_tracker::notify (this=0x5561c6a96340, e=...) at src/stats_tracker.cpp:367
#39 0x00005561c2c30ba0 in event_bus::send (this=<optimized out>, e=...) at src/event_bus.cpp:73
#40 0x00005561c2dc48c2 in event_bus::send<(event_type)4, tripoint const&, int_id<oter_t> const&> (this=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/allocator.h:184
#41 cata_event_dispatch::avatar_moves (old_abs_pos=..., u=..., m=...) at src/game.cpp:13684
#42 0x00005561c2dd8dea in game::walk_move (this=0x5561c6e3c270, dest_loc=..., via_ramp=via_ramp@entry=false, furniture_move=furniture_move@entry=false) at src/game.cpp:10720
#43 0x00005561c26be227 in avatar_action::move (you=..., m=..., d=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/unique_ptr.h:199
#44 0x00005561c2e71897 in avatar_action::move (d=<synthetic pointer>..., m=..., you=...) at src/avatar_action.h:39
#45 game::do_regular_action (this=this@entry=0x5561c6e3c270, act=@0x7ffd6abe5808: ACTION_MOVE_FORTH_RIGHT, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2209
#46 0x00005561c2e73d35 in game::handle_action (this=0x5561c6e3c270) at src/handle_action.cpp:3133
#47 0x00005561c2bb21ed in do_turn () at src/do_turn.cpp:541
#48 0x00005561c22f30cd in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:868

Attach save file

The "generated minimized save archive" is four times bigger than the uncompressed save directory and >30 times bigger than the zipped one.

Steps to reproduce

Happened when going into a police station in the city in the north. I couldn't reproduce it at will.

Expected behavior

No crashes.

Screenshots

No response

Versions and configuration

Additional context

No response

l29ah commented 4 months ago

2024.04.05.zip

katemonster33 commented 4 months ago

Just so I'm understanding - you're saying your steps to reproduce doesn't do it every time? Only sometimes?

l29ah commented 4 months ago

The referenced duplicate is doing it every time.

katemonster33 commented 4 months ago

Great! I will prioritize this

katemonster33 commented 4 months ago

@l29ah can you share your config? having trouble reproducing this locally, that might help

l29ah commented 4 months ago

My what?

katemonster33 commented 4 months ago

The contents of your config folder , zip them up and post them, they may help me in reproducing the issue

katemonster33 commented 4 months ago

@l29ah still need a zipped up copy of your cataclysm config directory

l29ah commented 1 month ago

https://0x0.st/XMCy.zip config dir sans saves. Sorry for the delay. Can reproduce it on todays master as well.

l29ah commented 1 month ago

A shiny new updated backtrace:

#0  0x00007f1f4ccc505c in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007f1f4cc752b6 in raise () from /lib64/libc.so.6
#2  0x00007f1f4cc5d8b7 in abort () from /lib64/libc.so.6
#3  0x0000558b63401e6e in signal_handler (sig=<optimized out>) at src/crash.cpp:154
#4  <signal handler called>
#5  0x00007f1f4ccc505c in __pthread_kill_implementation () from /lib64/libc.so.6
#6  0x00007f1f4cc752b6 in raise () from /lib64/libc.so.6
#7  0x00007f1f4cc5d8b7 in abort () from /lib64/libc.so.6
#8  0x00007f1f4cedab8f in std::__glibcxx_assert_fail (file=file@entry=0x558b64c9c288 "/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/array", line=line@entry=202, 
    function=function@entry=0x558b64cb1170 "constexpr std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](size_type) [with _Tp = RGBTuple; long unsigned int _Nm = 16; reference = RGBTuple&; size_type = long unsigned int]", 
    condition=condition@entry=0x558b64c40a2f "__n < this->size()") at /var/tmp/portage/sys-devel/gcc-14.1.1_p20240622/work/gcc-14-20240622/libstdc++-v3/src/c++11/assert_fail.cc:41
#9  0x0000558b6313857f in std::array<RGBTuple, 16ul>::operator[] (this=0x558b654e3fe0 <rgbPalette>, __n=237) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/array:200
#10 std::array<RGBTuple, 16ul>::operator[] (__n=237, this=0x558b654e3fe0 <rgbPalette>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/array:200
#11 cataimgui::imvec4_from_color (color=...) at src/cata_imgui.cpp:48
#12 0x0000558b632b1299 in nc_color::operator ImVec4 (this=this@entry=0x7ffe367e12c8) at src/color.cpp:34
#13 0x0000558b63139712 in PushOrPopColor (minimumColorStackSize=<optimized out>, seg=...) at src/cata_imgui.cpp:401
#14 cataimgui::window::draw_colored_text (this=this@entry=0x558bb52e75a0, text="<color_c_dark_gray>Achievement completion popups can be</color>", wrap_width=wrap_width@entry=0, is_selected=is_selected@entry=0x0, 
    is_focused=is_focused@entry=0x0, is_hovered=is_hovered@entry=0x0) at src/cata_imgui.cpp:460
#15 0x0000558b631399fc in cataimgui::window::draw_colored_text (this=this@entry=0x558bb52e75a0, text="<color_c_dark_gray>Achievement completion popups can be</color>", color=..., wrap_width=wrap_width@entry=0, 
    is_selected=is_selected@entry=0x0, is_focused=is_focused@entry=0x0, is_hovered=is_hovered@entry=0x0) at src/cata_imgui.cpp:427
#16 0x0000558b645b67e6 in query_popup_impl::draw_controls (this=0x558bb52e75a0) at src/popup.cpp:61
#17 0x0000558b6313792e in cataimgui::window::draw (this=0x558bb52e75a0) at src/cata_imgui.cpp:625
#18 0x0000558b64a21e28 in std::function<void(ui_adaptor&)>::operator() (__args#0=..., this=0x558bb4ba0698) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:591
#19 ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
#20 0x0000558b64a22151 in ui_adaptor::redraw () at src/ui_manager.cpp:345
#21 0x0000558b645b816d in query_popup::query_once (this=this@entry=0x7ffe367e1a60) at src/popup.cpp:295
#22 0x0000558b645b99af in query_popup::query (this=this@entry=0x7ffe367e1a60) at src/popup.cpp:408
#23 0x0000558b6442f835 in popup (
    text="<color_c_light_green>Achievement completed!</color>\n\n<color_c_light_green>Edged Combat</color>\n  <color_c_light_green>Blades are one of man's most useful tools.  It was true then and it's even more tr"..., 
    flags=flags@entry=PF_NONE) at src/output.cpp:950
#24 0x0000558b637794cf in achievement_attained (a=0x558b8b9b69a0, achievements_enabled=<optimized out>) at src/game.cpp:423
#25 0x0000558b62e21829 in std::function<void(achievement const*, bool)>::operator() (__args#1=<optimized out>, __args#0=0x558b8b9b69a0, this=0x558b8b4f1b70) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/std_function.h:591
#26 achievements_tracker::report_achievement (this=0x558b8b4f1b50, a=0x558b8b9b69a0, comp=achievement_completion::completed) at src/achievement.cpp:808
#27 0x0000558b64837c0e in watcher_set<stat_watcher>::send_to_all<stat_watcher, cata_variant const&, stats_tracker&, cata_variant const&, stats_tracker&> (mem_fn=&virtual table offset 16, this=<optimized out>) at src/stats_tracker.h:161
#28 stats_tracker::stat_value_changed (this=0x558b8b1d6e40, id=..., new_value=...) at src/stats_tracker.cpp:322
#29 0x0000558b64837b2e in watcher_set<event_multiset_watcher>::send_to_all<event_multiset_watcher, cata::event const&, stats_tracker&, cata::event const&, stats_tracker&> (mem_fn=&virtual table offset 16, this=0x558bb1a5f688)
    at src/stats_tracker.h:161
#30 stats_tracker::transformed_set_changed (this=0x558b8b1d6e40, id=..., new_element=...) at src/stats_tracker.cpp:304
#31 0x0000558b6361aacf in non-virtual thunk to event_transformation_impl::state::event_added(cata::event const&, stats_tracker&) () at src/event_statistics.cpp:473
#32 0x0000558b6483a0ee in watcher_set<event_multiset_watcher>::send_to_all<event_multiset_watcher, cata::event const&, stats_tracker&, cata::event const&, stats_tracker&> (mem_fn=&virtual table offset 16, this=<optimized out>)
    at src/stats_tracker.h:161
#33 stats_tracker::notify (this=0x558b8b1d6e40, e=...) at src/stats_tracker.cpp:367
#34 0x0000558b635d6670 in event_bus::send (this=<optimized out>, e=...) at src/event_bus.cpp:81
#35 0x0000558b631c7217 in event_bus::send<(event_type)69, character_id, string_id<Skill> const&, int&> (this=<optimized out>) at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/allocator.h:184
#36 Character::practice (this=this@entry=0x558b8b508780, id=..., amount=13, cap=cap@entry=1702126433, suppress_warning=suppress_warning@entry=true, allow_multilevel=allow_multilevel@entry=false) at src/character.cpp:2756
#37 0x0000558b633a49de in Character::craft_skill_gain (this=this@entry=0x558b8b508780, craft=..., num_practice_ticks=<error reading variable: Cannot access memory at address 0x7ffe00000007>) at src/crafting.cpp:1033
#38 0x0000558b62ea1219 in craft_activity_actor::do_turn (this=0x558bb41cd170, act=..., crafter=...) at src/activity_actor.cpp:3689
#39 0x0000558b64560085 in player_activity::do_turn (this=0x558b8b508e48, you=...) at src/player_activity.cpp:317
#40 0x0000558b635473eb in do_turn () at src/do_turn.cpp:532
#41 0x0000558b62c67c4d in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873
l29ah commented 1 month ago

Sledgehammered the broken code away for now:

--- a/src/cata_imgui.cpp
+++ b/src/cata_imgui.cpp
@@ -395,6 +395,7 @@ void cataimgui::imvec2_to_point( ImVec2 *src, point *dest )

 static void PushOrPopColor( const std::string_view seg, int minimumColorStackSize )
 {
+    return;
     color_tag_parse_result tag = get_color_from_tag( seg, report_color_error::yes );
     switch( tag.type ) {
         case color_tag_parse_result::open_color_tag:
l29ah commented 1 week ago

@l29ah can you share your config? having trouble reproducing this locally, that might help

Consider -D_GLIBCXX_ASSERTIONS as you should always do.