fix: handle SDK disposal gracefully to prevent crashes on app exit#3345
fix: handle SDK disposal gracefully to prevent crashes on app exit#3345
Conversation
Added error handling for StateError in balance-related methods to ensure that null values are returned gracefully when the SDK has been disposed. Updated the CoinBalance and CoinFiatBalance widgets to utilize the new balance method, improving stability and preventing crashes.
Added try-catch blocks to handle StateError when connecting and disconnecting the streaming service in the AuthBloc. This ensures that if the SDK has been disposed, the application will skip the connect/disconnect operations gracefully, improving stability and preventing potential crashes.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Visit the preview URL for this PR (updated for commit ec73a00): https://walletrc--pull-3345-merge-knc84lko.web.app (expires Mon, 10 Nov 2025 11:47:52 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc |

Fixes unhandled exceptions that occur when the application is closed while widgets and BLoCs are still accessing a disposed KomodoDefiSdk instance. This ensures graceful error handling instead of crashes during app shutdown.
Related Issues
Fixes #3341
Related to #3339
lastKnownUsdBalanceand_listenToAuthStateChangesmentioned in #3341. Due to the app architecture, similar errors can occur elsewhere when exiting the application, where the SDK has already been disposed but some components, widgets, or BLoCs are still trying to access it.p.s. If this PR is considered for merging, we should also consider merging #3339, which fixes another set of errors that occur on exit in Linux: