fix(undo): await DB writes in pushAction to prevent SIGBUS in tests

unawaited saveAction/deleteAction calls in pushAction could outlive the
test and access the SQLite connection after tearDown closed it, causing
the native FFI layer to hit freed memory (SIGBUS / exit code -7).

Making both DB calls awaited ensures pushAction only returns once the
action is fully persisted, eliminating the race condition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas SharedInbox
2026-05-17 07:37:43 +02:00
co-authored by Claude Sonnet 4.6
parent 6d4a1a0586
commit 01409a164b
+2 -2
View File
@@ -26,10 +26,10 @@ class UndoService extends StateNotifier<List<UndoAction>> {
final newList = [...state, action];
if (newList.length > _maxHistory) {
final removed = newList.removeAt(0);
unawaited(_ref.read(undoRepositoryProvider).deleteAction(removed.id));
await _ref.read(undoRepositoryProvider).deleteAction(removed.id);
}
state = newList;
unawaited(_ref.read(undoRepositoryProvider).saveAction(action));
await _ref.read(undoRepositoryProvider).saveAction(action);
}
Future<void> clear() async {