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

Fixes for window handling changes from f6d5c01 #9270

Merged
merged 1 commit into from May 15, 2021
Merged

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented May 15, 2021

Fixes #9269

Motivation / Problem

Since f6d5c01, windows' deletion is immediate.
Dropdowns and Pickers are abusing WC_INVALID class to hide themselves (triggering the assert in #9269).
ProcessScheduledInvalidations() can do invalid reads if window is self deleted during OnInvalidateData()

Description

Hide Dropdowns and Pickers by removing them from the opened windows list.
Modify OnInvalidateData() to return true if the window is self deleted, and check the return value to prevent invalid reads.

Limitations

Probably need to do the same for InvalidateData() as it calls OnInvalidateData().

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@frosch123
Copy link
Member

I would like a comment somewhere. This usage of WC_INVALID is pretty non-obvious :)

frosch123
frosch123 previously approved these changes May 15, 2021
@glx22 glx22 changed the title Fix #9269, f6d5c01: Skip invalid windows when checking z-priority Fixes for window handling changes from f6d5c01 May 15, 2021
@glx22
Copy link
Contributor Author

glx22 commented May 15, 2021

Removed the invalid reads part, it's not the right solution.

@glx22 glx22 merged commit e66e25f into OpenTTD:master May 15, 2021
@glx22 glx22 deleted the fix_9269 branch May 15, 2021 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion failed when trying to change refresh rate.
2 participants