Skip to content

Conversation

@DeckerSU
Copy link
Contributor

@DeckerSU DeckerSU commented Nov 3, 2025

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

⚠️ This PR only fixes the issues with lastKnownUsdBalance and _listenToAuthStateChanges mentioned 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:

embedder.cc (2572): 'FlutterEngineRemoveView' returned 'kInvalidArguments'. Remove view info was invalid. The implicit view cannot be removed.

** (KomodoWallet:558118): CRITICAL **: 20:57:49.660: FlOpenGLManager *fl_engine_get_opengl_manager(FlEngine *): assertion 'FL_IS_ENGINE(self)' failed
Segmentation fault (core dumped)

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.
@DeckerSU DeckerSU requested a review from CharlVS November 3, 2025 11:42
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch patch-fix-sdk-disposal-handling-on-exit

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

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

@smk762
Copy link
Collaborator

smk762 commented Nov 4, 2025

Caught same error as noted in linked issue after exit while logged in (during initial activation storm).
image

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.

3 participants