fix: selection race condition (#1194)
* fix: guard debounced desktop selection update Avoid dereferencing a cleared selection from the delayed macOS metrics callback and add a regression test that covers the stale-timer path. * chore: clean up analyzer warnings Remove redundant default arguments in tests and apply the missing trailing comma required by the current lint rules.
This commit is contained in:
parent
37521c205f
commit
6fbe7ba442
1 changed files with 50 additions and 5 deletions
|
|
@ -81,7 +81,13 @@ class _DesktopSelectionServiceWidgetState
|
|||
Debounce.debounce(
|
||||
'didChangeMetrics - update selection ',
|
||||
const Duration(milliseconds: 100),
|
||||
() => updateSelection(currentSelection.value!),
|
||||
() {
|
||||
final selection = currentSelection.value;
|
||||
if (!mounted || selection == null) {
|
||||
return;
|
||||
}
|
||||
updateSelection(selection);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue