Skip to content

Fix potential object lifetime issue in DSCView#8297

Merged
fuzyll merged 1 commit into
devfrom
test_fix_dsc_lifetime_issue
Jun 30, 2026
Merged

Fix potential object lifetime issue in DSCView#8297
fuzyll merged 1 commit into
devfrom
test_fix_dsc_lifetime_issue

Conversation

@fuzyll

@fuzyll fuzyll commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

While I was reviewing #8277, I got suspicious of some places where we were capturing this. It's late and I might be wrong, but I think there's a potential lifetime issue here.

I believe the following sequence is theoretically possible:

  1. DSCTriageView::loadImagesWithAddr() starts a background task
  2. The lambda in the worker captures this
  3. The worker starts running on a background thread
  4. The user closes the view
  5. DSCTriageView is destructed (or at least starts to be)
  6. The worker tries to access this->m_data

If 5 gets far enough before 6 happens, I think that could be a use-after-free? I also just think it's weird to have a background worker thread have a raw pointer to a UI object.

My change here is to just take a reference to the BV outside of the worker, rather than relying on the UI object. I think this should be the right move, but someone can let me know.

@fuzyll fuzyll added this to the Krypton milestone Jun 30, 2026
@fuzyll fuzyll requested a review from bdash June 30, 2026 06:11
@fuzyll fuzyll self-assigned this Jun 30, 2026
@fuzyll fuzyll force-pushed the test_fix_dsc_lifetime_issue branch from 003e938 to 170b180 Compare June 30, 2026 06:12

@bdash bdash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch!

@fuzyll fuzyll force-pushed the test_fix_dsc_lifetime_issue branch from 170b180 to c33abca Compare June 30, 2026 23:45
@fuzyll fuzyll merged commit c33abca into dev Jun 30, 2026
5 checks passed
@fuzyll fuzyll deleted the test_fix_dsc_lifetime_issue branch July 1, 2026 00:15
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