-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Settings reload causes occasional crash in SUI #9273
Comments
Marked for 1.8 -- @carlos-zamora FYI. Not so you fix it, just so you know I took Triage off. 😄 |
@DHowett Did you have a repro for this? |
SURE DO! PowerShell: while($true){sleep 0.5; touch $Env:LOCALAPPDATA\packages\WindowsTerminalDev_8wekyb3d8bbwe\localstate\settings.json } that will reload your settings EVERY 0.5 SECONDS. Keep the SUI open and navigate it. |
Some notes from looking into this a bit:
while($true){sleep 0.5; Add-Content $Env:LOCALAPPDATA\packages\WindowsTerminalDev_8wekyb3d8bbwe\localstate\settings.json " " } Working branch: dev/cazamor/sui/bugfix-reload-crash For whatever reason, |
## Summary of the Pull Request This commit fixes various race conditions regarding the settings UI. It's unsafe to write to class members from background threads without acquiring mutexes or yielding to the main thread first. By changing the settings reload code path to yield to the main thread early, we're able to cut down on code complexity and unsafe member accesses. ## PR Checklist * [x] Closes #9273 * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * Settings UI reloads without crashing ✔️
## Summary of the Pull Request This commit fixes various race conditions regarding the settings UI. It's unsafe to write to class members from background threads without acquiring mutexes or yielding to the main thread first. By changing the settings reload code path to yield to the main thread early, we're able to cut down on code complexity and unsafe member accesses. ## PR Checklist * [x] Closes #9273 * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * Settings UI reloads without crashing ✔️ (cherry picked from commit b034fc9) # Conflicts: # src/cascadia/TerminalApp/AppLogic.cpp # src/cascadia/TerminalApp/AppLogic.h
🎉This issue was addressed in #10390, which has now been successfully released as Handy links: |
🎉This issue was addressed in #10390, which has now been successfully released as Handy links: |
Directly manipulating the `NavigationView::MenuItems` vector is bad. If you do that, you're gonna get crashes, in WinUI code for `Measure`. However, a WinUI PR (below) gave me an idea: Changing `NavigationView::MenuItemsSource` will wholly invalidate the entirety of the nav view items, and that will avoid the crash. This code does that. It's a wee bit janky, but it works. Closes #13673 _might_ affect #12333, need to try and repro. See also: * #9273 * #10390 * microsoft/microsoft-ui-xaml#6302 * microsoft/microsoft-ui-xaml#3138, which was the fix for microsoft/microsoft-ui-xaml#2818
Directly manipulating the `NavigationView::MenuItems` vector is bad. If you do that, you're gonna get crashes, in WinUI code for `Measure`. However, a WinUI PR (below) gave me an idea: Changing `NavigationView::MenuItemsSource` will wholly invalidate the entirety of the nav view items, and that will avoid the crash. This code does that. It's a wee bit janky, but it works. Closes #13673 _might_ affect #12333, need to try and repro. See also: * #9273 * #10390 * microsoft/microsoft-ui-xaml#6302 * microsoft/microsoft-ui-xaml#3138, which was the fix for microsoft/microsoft-ui-xaml#2818 (cherry picked from commit 8c17475) Service-Card-Id: 88428128 Service-Version: 1.17
It looks like manipulating the Navigation View's menu still wigs it out a bit.
The text was updated successfully, but these errors were encountered: