Vector35 / Vector35/binaryninja-api

BackgroundThread API can have issues

Open
#6,585 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: API Component: UI Effort: Medium Impact: Medium
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

From #6300:

This is a mess of a race condition in the BackgroundThread api. What is happening is that the BackgroundThread doesn't actually hold a strong reference to its QObject parent and thus the view is getting destroyed while the thread is running. The thread only checks that its parent exists between each task, and doesn't actually stop its parent from being deleted mid-task. I'm looking into a way to have QObject::destroyed wait for the current task to finish before actually destroying the object, though this is quite janky.

There's been some additional discussion about this at the office wrt futures and whatnot. I don't remember all the details, but I'm making this issue so we don't lose track of the fact that this is still a problem in some contexts.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the BackgroundThread API and the related discussion in issue #6300, including the notes about QObject parents, task boundaries, and futures. Done should mean the lifetime race is addressed so a parent cannot be destroyed unsafely while a task is running, with the intended behavior established for the affected contexts.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.