fix(wownero): hold the history mutex while reading transactions

The 1.0.5 build 15 macOS test crashed with SIGSEGV in
WOWNERO_TransactionInfo_amount on the main thread, near the end of a
restore sync. TransactionHistory_refresh runs on a background isolate
under txHistoryMutex and frees the TransactionInfo objects it replaces;
getAllSubaddresses() and getTransaction() read those objects without
the mutex, so a read that overlaps a refresh dereferences freed memory.
The wallet cache had not been stored, so the next launch synced again.

Upstream fixed the same race for Monero in #3188 and in the v6.4.5
coin-control change; this ports both to cw_wownero. getAllSubaddresses()
and getTransaction() take the mutex and become async, which carries
through the subaddress list, its app proxy and the configure interface.
The subaddress list now fetches before clearing, so the observable list
is never empty while the fetch is pending, and addSubaddress and
setLabelSubaddress await the update before callers read the new address.

The coin-control change check compared a Transaction with 1 and was
always false; it now uses the transaction's direction, as Monero does.
This commit is contained in:
jwinterm
2026-10-31 12:50:36 -04:00
parent d0f4e20b29
commit f08ae897e6
6 changed files with 51 additions and 35 deletions
+1 -1
View File
@@ -658,7 +658,7 @@ abstract class WowneroSubaddressList {
ObservableList<Subaddress> get subaddresses;
void update(Object wallet, {required int accountIndex});
void refresh(Object wallet, {required int accountIndex});
List<Subaddress> getAll(Object wallet);
Future<List<Subaddress>> getAll(Object wallet);
Future<void> addSubaddress(Object wallet, {required int accountIndex, required String label});
Future<void> setLabelSubaddress(Object wallet,
{required int accountIndex, required int addressIndex, required String label});