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 CTRL+click to show a vehicle group that is collapsed #7974

LeandroSImmich opened this issue Feb 4, 2020 · 0 comments

Crash when CTRL+click to show a vehicle group that is collapsed #7974

LeandroSImmich opened this issue Feb 4, 2020 · 0 comments


Copy link

@LeandroSImmich LeandroSImmich commented Feb 4, 2020

Version of OpenTTD

Tested with latest nightly (20200202-master) - win64 - Windows 10

Issue details

Under some circumstances a crash (assertion failed) happens when the user CTRL+click to open/'bring to front' the vehicle group window and to show/select a vehicle's group (feature introduced in 1.10.0-beta2, #7800).

It seems to only (and always) happen when both these conditions apply:
a) the vehicle's group has at least one parent (is not at root level) and at least one of its parents is collapsed (feature introduced in 1.10.0-beta1, #7417)
b) the vehicle group window would need a scroll down to show the clicked vehicle's group on the tree-view.

I set up 3 savegames with some of the simplest example cases for the issue:

  1. 9 groups, each being a subgroup of the previous one (a 9-deep level group structure)
    (cases 1 and 2 crash with a default group window size of 8 groups shown, or smaller)
    Case #1-Expanded

  2. 9 groups, each being a root group except one, which is a subgroup of the last root group
    Case #2-Expanded

  3. 3 groups, 2 at root level and another being a subgroup of the last one
    Case #3-Expanded-1

(case 3 only crashes with a resized group window, to its minimum height of 2 groups shown)
Case #3-Expanded-2

Expected result

The vehicle group window is opened (if not already), and scrolled if needed to show/select the vehicle's group.

Actual result

The game crashes with the error message:
Assertion failed at line 702 of d:\a\1\s\src\widget_type.h: this->count <= this->cap ? (position == 0) : (position + this->cap <= this->count)


Steps to reproduce

  1. Load one of the 3 saves
  2. Click on the 'Display list of company's road vehicles' button on the toolbar to open the road vehicle group window
  3. Collapse any group/node on the tree-view of the groups, to hide its subgroups
  4. If testing case 3, resize the vehicle group window to its minimum height (only 2 groups shown)
  5. CTRL+click on the vehicle and the game will crash with "Assertion failed at line 702 of src\widget_type.h"


Features 7800 7417 issue -

stormcone added a commit to stormcone/OpenTTD that referenced this issue Feb 4, 2020
@LordAro LordAro closed this in 492d270 Feb 6, 2020
douiwby added a commit to douiwby/OpenTTD that referenced this issue Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.