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 in newobject window #5567

Closed
DorpsGek opened this issue May 30, 2013 · 4 comments
Closed

Crash in newobject window #5567

DorpsGek opened this issue May 30, 2013 · 4 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

zooks opened the ticket and wrote:

Trunk r25306

Steps to reproduce:

  1. open object window
  2. select motorways
  3. scroll down and select median with third lane
  4. close object window
  5. open object window again

It also occurs when selecting different objects in step 3

Grf attached

Attachments

Reported version: trunk
Operating system: All


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

sbr wrote:

When opening the BuildObjectWindow, the index of the selected object is passed to NWidgetMatrix::SetClicked().
However this method expect the UI index of the object, not its spec index.

Please find attached a patch against r25306.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5567#comment12254

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 1, 2013

frosch wrote:

The BuildObjectWindow constructor looks kind of weird.
Usually SelectOtherObject does the SetClicked stuff, but currently SelectOtherObject is called very early in the constructor and only after that the matrix is initialised, which seems to be needed after changing the selected class.
In fact the matrix->SetCount is only called in the constructor and in OnClick, but not when SelectFirstAvailableObject switches the class (which is only called via the constructor).

Would this get better, if there was a SelectOtherClass method, which would do the matrix configuration, and which would be called from SelectFirstAvailableObject, OnClick etc.?


This comment was imported from FlySpray: https://bugs.openttd.org/task/5567#comment12257

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 4, 2013

sbr wrote:

The first patch is just bumped to r25321.
The second patch initialize the object matrix before trying to restore the selected object. SetClicked() in SelectOtherObject() when called from the constructor is now active. That eleminate the need of a second call to SetClicked() at the end of the constructor.
The third patch introduce a SelectOtherClass() method to remove duplication when a new object class is selected.
The fourth patch resize the window before setting up the object matrix to ensure SetClicked() works properly when a custom window size is restored.

Please find attached these fourth patches against r25321.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5567#comment12276

@DorpsGek
Copy link
Member Author

frosch closed the ticket.

Reason for closing: Fixed

in r25538. Thanks to sbr for the patches :)


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

@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