Skip to content

fix(monero-wallet): hold a weak wallet handle in the wallet listeners - #1230

Merged
binarybaron merged 1 commit into
fix/monero-sys-join-wallet-threadfrom
fix/wallet-listener-weak-handle
Oct 9, 2026
Merged

binarybaron merged 1 commit into
fix/monero-sys-join-wallet-threadfrom
fix/wallet-listener-weak-handle

Conversation

@binarybaron

Copy link
Copy Markdown

Depends on #1229. The base of this PR is the branch of #1229.

WalletHandleListener and TauriWalletListener held an Arc<WalletHandle> to the wallet that they listen to. The wallet thread owns its listeners, so the channel to the wallet thread never closed. Thus the main wallet in Wallets never closed and never did a final store, also after all other holders dropped it.

This PR adds WeakWalletHandle (WalletHandle::downgrade and WeakWalletHandle::upgrade). Both listeners now hold a WeakWalletHandle and upgrade it in their tokio tasks. The upgrade does not occur in the listener callback, because the callbacks run on the wallet thread or on the C++ refresh thread. If the last WalletHandle dropped on the C++ refresh thread, the join from #1229 would deadlock, because closeWallet waits until the C++ refresh thread stops.

WalletHandleListener and TauriWalletListener held an Arc<WalletHandle> to
the wallet that owns them. Thus the channel to the wallet thread never
closed, and the main wallet never closed. Add WeakWalletHandle, and let
the listeners upgrade it in their tokio tasks.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Deploying eigenwallet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0aa8ab7
Status: ✅  Deploy successful!
Preview URL: https://b48cedbc.eigenwallet-docs.pages.dev
Branch Preview URL: https://fix-wallet-listener-weak-han.eigenwallet-docs.pages.dev

View logs

@binarybaron
binarybaron merged commit 0aa8ab7 into fix/monero-sys-join-wallet-thread Oct 9, 2026
42 of 88 checks passed
@binarybaron

Copy link
Copy Markdown
Author

Moved into #1229.

@binarybaron
binarybaron deleted the fix/wallet-listener-weak-handle branch October 9, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant