Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on logout #1749

Merged
merged 1 commit into from
Nov 7, 2023
Merged

Fix crash on logout #1749

merged 1 commit into from
Nov 7, 2023

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Nov 7, 2023

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Replaces a call to client.setDelegate(null) with destroying the TashHandle returned by client.setDelegate now.

Motivation and context

Fix a crash that happened after a logout, where the delegate was called even after using client.setDelegate(null).

Tests

  • Log in.
  • Log out.
  • Wait for 30s-1min.

It if doesn't crash (or if Maestro passes), it's fixed.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 11

Checklist

@jmartinesp jmartinesp requested a review from a team as a code owner November 7, 2023 10:52
@jmartinesp jmartinesp requested review from julioromano and removed request for a team November 7, 2023 10:52
Copy link

sonarcloud bot commented Nov 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (74ccdf8) 63.33% compared to head (7501440) 63.33%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1749   +/-   ##
========================================
  Coverage    63.33%   63.33%           
========================================
  Files         1286     1286           
  Lines        33421    33421           
  Branches      6962     6962           
========================================
  Hits         21167    21167           
  Misses        9057     9057           
  Partials      3197     3197           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Nov 7, 2023

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/VyES2U

Copy link

@julioromano julioromano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but see my remarks in the chat room.
This looks like a behavior change without an API change.
setDelegate has been returning a TaskHandle for months.
Perhaps best to discuss with the rust folks.

@jmartinesp
Copy link
Member Author

We already discussed this, but I'm posting it here so we have some context of why it's needed. Taken from matrix-org/matrix-rust-sdk@ad5761b:

The fix here consists in having Client::set_delegate return a task handle that needs to be stashed by the FFI
users, and cancelled when the Client gets out of scope. This fixes the leak, by removing the last reference onto
the Client.

@jmartinesp jmartinesp merged commit 52c9565 into develop Nov 7, 2023
17 checks passed
@jmartinesp jmartinesp deleted the fix/jme/fix-crash-on-logout branch November 7, 2023 13:24
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.

2 participants