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

Fix #7088: close AI/GS textfile window when their data are invalid #7094

Merged
merged 1 commit into from Feb 6, 2020

Conversation

@SamuXarick
Copy link
Contributor

SamuXarick commented Jan 24, 2019

… displaying a textfile

Copy link
Member

LordAro left a comment

Not a fan of this solution, it's too brittle. The issue boils down to the Window trying to maintain something consistent when the underlying state (the slot) changes.

Instead, the window should "save" the ScriptConfig object (GetConfig(slot)) in its constructor, and just refer to that from then on. Should help to fix a couple of the other recent issues (#7090, #7091) as well, I think...

@SamuXarick
Copy link
Contributor Author

SamuXarick commented Jan 25, 2019

I added a solution based on OnInvalidateData, to complement the first. The only place I can think of that could alter the content of this window is via WC_AI_LIST (the window that lets me chose from a list of available AIs/GSs). So that's where it's called from at the moment.

@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch from cbef522 to 7cd6d41 Jan 30, 2019
@SamuXarick SamuXarick changed the title Fix #7088: Retrieve an appropriate name for a non-existant AI/GS when… Fix #7088: Retrieve an appropriate name for a non-existant AI/GS when displaying a textfile Jan 30, 2019
@stale
Copy link

stale bot commented Mar 1, 2019

This pull request has been automatically marked as stale because it has not had any activity in the last month.
Please feel free to give a status update now, ping for review, or re-open when it's ready.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale label Mar 1, 2019
@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch from 7cd6d41 to 267a6ff Mar 1, 2019
@stale stale bot removed the stale label Mar 1, 2019
@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch from 267a6ff to 7a2c654 Mar 31, 2019
@SamuXarick
Copy link
Contributor Author

SamuXarick commented Mar 31, 2019

For some reason, this fix stopped working properly. :(

EDIT: fixed it.

src/ai/ai_gui.cpp Outdated Show resolved Hide resolved
@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch from 7a2c654 to 3202db5 Mar 31, 2019
@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch 3 times, most recently from 4477d17 to 08ecbf1 Apr 11, 2019
@stale
Copy link

stale bot commented May 13, 2019

This pull request has been automatically marked as stale because it has not had any activity in the last month.
Please feel free to give a status update now, ping for review, or re-open when it's ready.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale label May 13, 2019
@andythenorth
Copy link
Contributor

andythenorth commented Jun 29, 2019

Stale. Closing, thanks.

@SamuXarick
Copy link
Contributor Author

SamuXarick commented Jul 19, 2019

ping for review

@LordAro LordAro reopened this Nov 15, 2019
@LordAro LordAro dismissed their stale review Nov 15, 2019

outdated

@LordAro LordAro removed the stale label Nov 15, 2019
@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch from 08ecbf1 to 3398ff6 Nov 15, 2019
src/ai/ai_gui.cpp Outdated Show resolved Hide resolved
@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch from 3398ff6 to 1426f45 Dec 27, 2019
@SamuXarick SamuXarick changed the title Fix #7088: Retrieve an appropriate name for a non-existant AI/GS when displaying a textfile Fix #7088: close AI/GS textfile window when their data are invalid Dec 27, 2019
@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch from 1426f45 to 3761d8f Dec 31, 2019
@nielsmh nielsmh dismissed LordAro’s stale review Feb 6, 2020

No more memory leak

src/ai/ai_gui.cpp Outdated Show resolved Hide resolved
@SamuXarick SamuXarick force-pushed the SamuXarick:ai-gs-name-for-textfile-window branch from 3761d8f to 503c63c Feb 6, 2020
@nielsmh
nielsmh approved these changes Feb 6, 2020
@LordAro
LordAro approved these changes Feb 6, 2020
@LordAro LordAro merged commit 3089c62 into OpenTTD:master Feb 6, 2020
8 checks passed
8 checks passed
Commit checker
Details
OpenTTD CI Build #20200206.8 succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.9) Linux linux-amd64-clang-3.9 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
@LordAro LordAro changed the title Fix #7088: close AI/GS textfile window when their data are invalid Fix #7088: close AI/GS textfile window when their data are invalid Feb 6, 2020
@SamuXarick SamuXarick deleted the SamuXarick:ai-gs-name-for-textfile-window branch Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.