Fix interface out of bounds error on MSYS2 #155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Problem
Interfaces have a bug which can cause out-of-bounds errors in MSYS2. When running the UI test in MSYS2 via
sktest.exe, the following error is received:Cause
The error can be traced back to
interface.cpp, line 308 in the_update_row_layoutfunction, which has:sk_interface_set_layout(container_stack.back().layout_widths.size(), &container_stack.back().layout_widths[0], container_stack.back().layout_height);This line attempts to access the
layout_widthsvector's first element (container_stack.back().layout_widths[0]), but many callers of_update_row_layoutclearlayout_widthsbeforehand, meaning the vector is empty and the out-of-bounds error occurs.Fix
A simple guard has been added to
_update_row_layout, to check iflayout_widthsis empty before proceeding.Type of change
How Has This Been Tested?
Tested primarily using the UI test in
sktest.exein MSYS2 and WSL. Interface displays as expected, with no errors received:Testing Checklist
Note for Testers
There have been some reported issues running
sktest(at all) on MSYS2. Specifically, the animation test was found to loop indefinitely, and some users found the test runner was freezing even before tests were launched. This has been addressed in #132.Checklist