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

Crash when opening a buoy window #4181

Closed
DorpsGek opened this issue Oct 24, 2010 · 1 comment
Closed

Crash when opening a buoy window #4181

DorpsGek opened this issue Oct 24, 2010 · 1 comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

Krille opened the ticket and wrote:

r21023

Since r21020 the game crashes when opening a buoy window.

I'm not sure what the
this->wp->IsInUse() ? this->wp->train_station.GetCenterTile() : this->wp->xy;
in GetCenterTile() is trying to archive. But since buoys are also waypoints and don't have anything to do with trains it will crash when calling this for a buoy.

The patch fixes it.

BTW: The ScrollWindowToTile() in OnResize() isn't necessary to make the viewport recenter during resize, it already did that before. However this seems to be a better place.

The recentering works because there's also a ScrollWindowToTile() in OnInvalidateData() which is triggered by the this->wp->UpdateVirtCoord() in OnResize(). Now it's done twice.

waypoint_cmd.cpp has a quite convoluted usage of UpdateVirtCoord() and InvalidateWindowData(). There seems to be quite a bit of potential for cleanup. However, when doing this there's an important point to remember: When building a new waypoint a near waypoint that has been destroyed recently can be reused. This makes it jump to the new position, so the waypoint window also has to scroll there, which it currently does.

The task would be to clean up the code without breaking this.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/4181
@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r21035. Thanks for the diff


This comment was imported from FlySpray: https://bugs.openttd.org/task/4181

@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant