Skip to content

Conversation

@criticalAY
Copy link
Contributor

Purpose / Description

Root Cause of the issue was:

  • Persistent Flow Subscription: Each time handleMultimediaActions is called, a new subscription to the multimediaAction flow is created, leading to multiple active observers.
  • Race Condition: When an action is emitted, all active subscriptions are notified, causing the action to be handled multiple times.

Fixes

Approach

Keep track of the job

How Has This Been Tested?

Tested on Google emulator API35

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

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

Ok, this seems to fix the linked issue at least

Note: there's a bug if MultimediaImageFragments's activity gets killed during the user choosing an image for example. If this happens the user will be stuck in the choosing screen.

How to reproduce: enable "Don't keep activities" -> NoteEditor -> Attach Icon -> go and select "Open gallery" -> try to select an image -> stuck in the image chooser screen

It would be nice to fix this issue in this PR(it's the same opening multiple times but for a different reason) but I would also accept merging this and creating an issue with the bug above.

@lukstbit lukstbit added Needs Author Reply Waiting for a reply from the original author Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Nov 17, 2024
@criticalAY criticalAY removed the Needs Author Reply Waiting for a reply from the original author label Nov 23, 2024
@criticalAY
Copy link
Contributor Author

Handled that

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

@criticalAY Is a test here feasible?

If not, let's get this in

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Dec 2, 2024
@criticalAY
Copy link
Contributor Author

We can get it in, I created test in a separate PR

@criticalAY criticalAY removed the Needs Author Reply Waiting for a reply from the original author label Dec 5, 2024
@david-allison david-allison added this pull request to the merge queue Dec 5, 2024
@david-allison
Copy link
Member

🚀🚀

Merged via the queue into ankidroid:main with commit 914a015 Dec 5, 2024
9 checks passed
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Dec 5, 2024
@github-actions github-actions bot added this to the 2.21 release milestone Dec 5, 2024
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.

BUG: Multimedia Option Open Twice When Bottom Sheet is Opened Twice

3 participants