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

Fixes #608: Random crash when changing folder #624

Merged
merged 3 commits into from
Jul 28, 2021

Conversation

marbetschar
Copy link
Member

@marbetschar marbetschar commented Jul 22, 2021

The crash described in #608 is caused by some asynchronous voodoo, where folders[service_uid] is already freed at the time when get_search_result_uids () tries to access it.

This PR mitigates the issue by adding the following safety measures:

  1. Set folders[service_uid] = folder before binding to folder.changed signal - just to be sure (swapped lines 146 and 147)
  2. get_search_result_uids function locks the folders HashMap during its executing to prevent changes
  3. get_search_result_uids function checks for existence of folders[service_uid] - if it does not exists, it returns null
  4. Callers of the get_search_result_uids function handle the null case gracefully

@marbetschar marbetschar changed the title Fixes #608: Random Folder Changed Crash Fixes #608: Random crash when changing folder Jul 22, 2021
@danirabbit danirabbit requested a review from a team July 23, 2021 16:45
@danirabbit danirabbit mentioned this pull request Jul 28, 2021
Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

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

I was able to reproduce a crash in master without this branch and cannot reproduce it with this branch. Nice work :)

@danirabbit danirabbit merged commit 55ad3e9 into master Jul 28, 2021
@danirabbit danirabbit deleted the fix-folder-changed-crash branch July 28, 2021 17:40
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