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

Segfault when opening uilist menus #76110

Closed
osuphobia opened this issue Sep 1, 2024 · 8 comments
Closed

Segfault when opening uilist menus #76110

osuphobia opened this issue Sep 1, 2024 · 8 comments
Labels
<Crash / Freeze> Fatal bug that results in hangs or crashes. ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@osuphobia
Copy link
Contributor

osuphobia commented Sep 1, 2024

Describe the bug

After updating to the newest version, trying to heal yourself result in crashing.

The program has crashed.
See the log file for a stack trace.
CRASH LOG FILE: ./config/crash.log
VERSION: 0527e71
TYPE: class std::bad_optional_access
MESSAGE: Bad optional access
STACK TRACE:

  #0
    (dbghelp: debug_write_backtrace+0xb5@0,000,7FF,67E,CFF,A95[cataclysm-tiles.exe+0x54f,a95]), 
  #1
    (dbghelp: log_crash+0x36d@0,000,7FF,67E,CC1,F8D[cataclysm-tiles.exe+0x511,f8d]), 
  #2
    (dbghelp: `crash_terminate_handler'::`1'::catch$5+0x43@0,000,7FF,680,550,3E3[cataclysm-tiles.exe+0x1,da0,3e3]), 
  #3
    (dbghelp: CallSettingFrame_LookupContinuationIndex+0x20@0,000,7FF,680,38B,420[cataclysm-tiles.exe+0x1,bdb,420]), 
  #4
    (dbghelp: __FrameHandler4::CxxCallCatchBlock+0x115@0,000,7FF,680,38A,325[cataclysm-tiles.exe+0x1,bda,325]), 
  #5
    (dbghelp: RtlCaptureContext2+0x4a6@0,000,7FF,ACC,071,C96[ntdll.dll+0xa1,c96]), 
  #6
    (dbghelp: crash_terminate_handler+0x44@0,000,7FF,67E,CC1,B34[cataclysm-tiles.exe+0x511,b34]), 
  #7
    (dbghelp: terminate+0x22@0,000,7FF,680,3AA,242[cataclysm-tiles.exe+0x1,bfa,242]), 
  #8
    (dbghelp: _scrt_unhandled_exception_filter+0x5a@0,000,7FF,680,37D,512[cataclysm-tiles.exe+0x1,bcd,512]), 
  #9
    (dbghelp: UnhandledExceptionFilter+0x1e7@0,000,7FF,AC9,A13,4A7[KERNELBASE.dll+0x133,4a7]), 
  #10
    (dbghelp: memset+0x1,218@0,000,7FF,ACC,075,898[ntdll.dll+0xa5,898]), 
  #11
    (dbghelp: _C_specific_handler+0x96@0,000,7FF,ACC,05C,E56[ntdll.dll+0x8c,e56]), 
  #12
    (dbghelp: _chkstk+0x11f@0,000,7FF,ACC,072,92F[ntdll.dll+0xa2,92f]), 
  #13
    (dbghelp: RtlRaiseException+0x484@0,000,7FF,ACC,022,554[ntdll.dll+0x52,554]), 
  #14
    (dbghelp: RtlRaiseException+0x1d7@0,000,7FF,ACC,022,2A7[ntdll.dll+0x52,2a7]), 
  #15
    (dbghelp: RaiseException+0x69@0,000,7FF,AC9,91B,699[KERNELBASE.dll+0x3b,699]), 
  #16
    (dbghelp: CxxThrowException+0x90@0,000,7FF,680,37D,A90[cataclysm-tiles.exe+0x1,bcd,a90]), 
  #17
    (dbghelp: std::_Throw_bad_optional_access+0x2e@0,000,7FF,67E,CCF,FBE[cataclysm-tiles.exe+0x51f,fbe]), 
  #18
    (dbghelp: uilist_impl::draw_controls+0x7c2@0,000,7FF,67E,F88,712[cataclysm-tiles.exe+0x7d8,712]), 
  #19
    (dbghelp: cataimgui::window::draw+0x1ed@0,000,7FF,67E,DF4,B6D[cataclysm-tiles.exe+0x644,b6d]), 
  #20
    (dbghelp: ui_adaptor::redraw_invalidated+0x411@0,000,7FF,67E,E19,621[cataclysm-tiles.exe+0x669,621]), 
  #21
    (dbghelp: uilist::query+0x1f3@0,000,7FF,67E,F89,E13[cataclysm-tiles.exe+0x7d9,e13]), 
  #22
    (dbghelp: Character::body_window+0x2,af9@0,000,7FF,67F,2AA,D29[cataclysm-tiles.exe+0xafa,d29]), 
  #23
    (dbghelp: pick_part_to_heal+0x18b@0,000,7FF,67F,CA5,CFB[cataclysm-tiles.exe+0x1,4f5,cfb]), 
  #24
    (dbghelp: heal_actor::use_healing_item+0x883@0,000,7FF,67F,CC5,DD3[cataclysm-tiles.exe+0x1,515,dd3]), 
  #25
    (dbghelp: heal_actor::use+0x285@0,000,7FF,67F,CB0,9A5[cataclysm-tiles.exe+0x1,500,9a5]), 
  #26
    (dbghelp: use_function::call+0x1d@0,000,7FF,67F,FFB,C0D[cataclysm-tiles.exe+0x1,84b,c0d]), 
  #27
    (dbghelp: itype::invoke+0x159@0,000,7FF,67F,A23,CC9[cataclysm-tiles.exe+0x1,273,cc9]), 
  #28
    (dbghelp: Character::invoke_item+0x69d@0,000,7FF,67F,086,D5D[cataclysm-tiles.exe+0x8d6,d5d]), 
  #29
    (dbghelp: Character::use+0xc8b@0,000,7FF,67F,0B5,93B[cataclysm-tiles.exe+0x905,93b]), 
  #30
    (dbghelp: avatar_action::use_item+0xc91@0,000,7FF,67F,ADE,1A1[cataclysm-tiles.exe+0x1,32e,1a1]), 
  #31
    (dbghelp: avatar_action::eat_or_use+0x6e@0,000,7FF,67F,AD5,82E[cataclysm-tiles.exe+0x1,325,82e]), 
  #32
    (dbghelp: game::do_regular_action+0x1,350@0,000,7FF,67F,3BE,9E0[cataclysm-tiles.exe+0xc0e,9e0]), 
  #33
    (dbghelp: game::handle_action+0xa37@0,000,7FF,67F,3C8,397[cataclysm-tiles.exe+0xc18,397]), 
  #34
    (dbghelp: do_turn+0xf47@0,000,7FF,67E,D07,767[cataclysm-tiles.exe+0x557,767]), 
  #35
    (dbghelp: WinMain+0xe95@0,000,7FF,67E,B8C,535[cataclysm-tiles.exe+0x3dc,535]), 
  #36
    (dbghelp: __scrt_common_main_seh+0x106@0,000,7FF,680,37C,B56[cataclysm-tiles.exe+0x1,bcc,b56]), 
  #37
    (dbghelp: BaseThreadInitThunk+0x14@0,000,7FF,ACB,5C7,374[KERNEL32.DLL+0x17,374]), 
  #38
    (dbghelp: RtlUserThreadStart+0x21@0,000,7FF,ACC,01C,C91[ntdll.dll+0x4c,c91]), 

Attach save file

San Pierre-trimmed.tar.gz

Steps to reproduce

Get yourself damaged, try to bandage yourself and got kicked out.

Expected behavior

No crashing

Screenshots

2024-09-01 173306

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19045.4780 (22H2)
  • Game Version: 0527e71 [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]
    ]

Additional context

No response

@osuphobia osuphobia added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Sep 1, 2024
@Malorn-Deslor
Copy link
Contributor

Yep, I'm getting the same issue. You can cause it with just about any healing item from what I am seeing.

@Malorn-Deslor
Copy link
Contributor

Reverting to 2024-08-31-2037 removes the crash, so somebody did something unwise.

@RenechCDDA
Copy link
Member

It looks like the below just needs to be wrapped in an if, but I can't get it to crash on my end.

Cataclysm-DDA/src/ui.cpp

Lines 135 to 136 in ea87d2d

cataimgui::draw_colored_text( entry.hotkey.value().short_description(),
is_selected ? parent.hilight_color : parent.hotkey_color );

It was wrapped in an if, it just seems to have gotten lost in the shuffle.

https://github.com/db48x/Cataclysm-DDA/blob/cdd78abb2d40a716d23415c89943da40c4d92799/src/ui.cpp#L115-L119

@RenechCDDA RenechCDDA added <Crash / Freeze> Fatal bug that results in hangs or crashes. ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds labels Sep 1, 2024
@RenechCDDA
Copy link
Member

Looks like a LOT of people are getting this, and I'm pretty confident in saying it is a real bug. So I'm just going to go ahead and pin it and shuffle everyone over to this issue.

If you crash today when viewing a uilist and the stack trace mentions bad optional access... it's the same one as this.

@RenechCDDA RenechCDDA added (S2 - Confirmed) Bug that's been confirmed to exist and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Sep 1, 2024
@RenechCDDA RenechCDDA pinned this issue Sep 1, 2024
@tcld
Copy link
Contributor

tcld commented Sep 1, 2024

It looks like the below just needs to be wrapped in an if, but I can't get it to crash on my end.

Cataclysm-DDA/src/ui.cpp

Lines 135 to 136 in ea87d2d

cataimgui::draw_colored_text( entry.hotkey.value().short_description(),
is_selected ? parent.hilight_color : parent.hotkey_color );

It was wrapped in an if, it just seems to have gotten lost in the shuffle.

https://github.com/db48x/Cataclysm-DDA/blob/cdd78abb2d40a716d23415c89943da40c4d92799/src/ui.cpp#L115-L119

Adding the if to wrap the statement did fix the problem for me.

@HadeanLake
Copy link
Contributor

I was teleporting my character one level up to make him fall down and get hurt...
If someone cannot reproduce this - make sure not all menu items have a hotkey - e.g. not all body parts hurt or not all spells can be learned etc.
2024-09-01-215542_1920x1080_scrot

@RenechCDDA RenechCDDA changed the title Segfault when trying to bandage the avatar Segfault when opening uilist menus Sep 2, 2024
@db48x
Copy link
Contributor

db48x commented Sep 3, 2024

I don’t know how it got lost, but lost in the shuffle it was. I fixed it in #76157 though, because while I hadn’t seen this bug report I did happen to notice the problem while working on it.

@RenechCDDA
Copy link
Member

Looks like that should fix it. Well if it didn't I'm sure we'll get plenty more reports :)

@RenechCDDA RenechCDDA unpinned this issue Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Crash / Freeze> Fatal bug that results in hangs or crashes. ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

No branches or pull requests

6 participants