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

[quickfort] fix rare crash in buildingplan when switching ui modes #246

Merged
merged 3 commits into from Jan 29, 2021

Conversation

myk002
Copy link
Member

@myk002 myk002 commented Jan 27, 2021

Fixes DFHack/dfhack#1762

by manually changing df.global.ui.main.mode we skipped validity checking the ui normally does on state change. this sometimes resulted in bad data in world->selected_building, which caused buildingplan to crash. using the UI to switch modes avoids this problem.

by manually changing df.global.ui.main.mode we skipped validity checking
the ui normally does on state change. this sometimes resulted in bad
data in world->selected_building, which caused buildingplan to crash.
using the UI to switch modes avoids this problem.
-- send keycodes to exit the current UI sidebar mode and enter another one with
-- the given keycode. we verify before calling this function that we are in a
-- mode that can be exited with one press of ESC.
local function switch_ui_sidebar_mode(mode_keycode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably make this take a sidebar mode instead of a keycode (I think that would just require moving valid_ui_sidebar_modes above this function), but it works this way too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. I'll make that change.

@lethosor lethosor added this to In progress in 0.47.04-r5 via automation Jan 29, 2021
@myk002 myk002 merged commit e20fa9f into DFHack:master Jan 29, 2021
0.47.04-r5 automation moved this from In progress to Done Jan 29, 2021
@myk002 myk002 deleted the myk_ui_mode_switching branch January 29, 2021 05:37
lethosor added a commit to DFHack/dfhack that referenced this pull request Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.47.04-r5
  
Done
2 participants