fix: shut down worker QThreads safely on close#45
Merged
Conversation
Closing a dialog or the main window while a background worker QThread was still running could abort the process with "QThread: Destroyed while thread is still running", or deadlock on the BlockingQueuedConnection used by the scan workers. - Add shutdown_worker_thread() helper that cancels, disconnects signals, and detaches workers that won't stop in time so they're never destroyed while running. - Pump the event loop while waiting on the scan worker to avoid the BlockingQueuedConnection deadlock. - Stop the heartbeat before teardown and close worker-bearing auxiliary dialogs on main window close. - Keep the old process handle open until the old cheat poller is joined when switching targets. - Guard cellChanged against items cleared mid-teardown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closing a dialog or the main window while a background worker
QThreadwas still running could abort the whole process withQThread: Destroyed while thread is still running, or deadlock on theBlockingQueuedConnectionthe scan workers use to hand chunks back to the GUI thread.This PR makes worker-thread teardown safe across the app.
Changes
shutdown_worker_thread()helper that cancels the worker, disconnects every signal up front, and detaches any worker still wedged in a backend call when the wait expires — held in a module-level list so the closing dialog never destroys a live thread.BlockingQueuedConnectionchunk_readyemit can be serviced instead of deadlocking.memory map,threads,modules,pointer scan) so each joins its own thread.cellChangedagainst items already cleared mid-teardown.