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 crash on close #1068

Merged
merged 2 commits into from
Mar 14, 2024
Merged

Fix crash on close #1068

merged 2 commits into from
Mar 14, 2024

Conversation

Al12rs
Copy link
Contributor

@Al12rs Al12rs commented Mar 14, 2024

This was due to WorkspaceViewModel unregistering itself from WorkspaceController.AllWorkspaces when it is deactivated (WhenActivated DisposeWith).

This changed the number of children during the OnDetachedFromVisualTree calls.
Removing the call to UnregisterWorkspace in the disposable here fixes the crash on close.

Currently we don't actually have any way to remove workspaces, as there is no way to delete a loadout. So for now the removal code is inactive. We will figure out how that works when we support deleting loadouts.

Part of #906.

- Avoid removing the WorkspaceViewModel from AllWorkspaces list when deactivating it. This triggered an index out of range error during `OnDetachedFromVisualTree` on App close.
@Al12rs Al12rs requested a review from erri120 March 14, 2024 10:34
@Al12rs Al12rs added this to the v0.4 milestone Mar 14, 2024
@Al12rs Al12rs mentioned this pull request Mar 14, 2024
34 tasks
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.75%. Comparing base (5c4ef18) to head (869270b).
Report is 82 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1068      +/-   ##
==========================================
- Coverage   54.82%   54.75%   -0.07%     
==========================================
  Files         662      662              
  Lines       21997    22008      +11     
  Branches     1717     1704      -13     
==========================================
- Hits        12059    12050       -9     
- Misses       9541     9561      +20     
  Partials      397      397              
Flag Coverage Δ
Linux 54.12% <100.00%> (-0.03%) ⬇️
Windows 54.03% <100.00%> (-0.03%) ⬇️
clean_environment_tests 54.74% <100.00%> (-0.07%) ⬇️
macOS ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...UI/WorkspaceSystem/Workspace/WorkspaceViewModel.cs 47.75% <100.00%> (-0.69%) ⬇️
...eSystem/WorkspaceController/WorkspaceController.cs 35.80% <100.00%> (-0.28%) ⬇️

... and 12 files with indirect coverage changes

@Al12rs Al12rs merged commit 62331b5 into main Mar 14, 2024
5 checks passed
@Al12rs Al12rs deleted the crash_on_close branch March 14, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants