About dialog: UpdateCheckWorker QThread destroyed if dialog closes mid-check (crash) #32
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found in audit of
main@06326e5.MainWindow._show_about()runsAboutDialog(self).exec()on a temporary.AboutDialog._check_for_updates()stores the running worker only on the dialog (self._worker = UpdateCheckWorker()). If the user clicks Check for updates and closes the dialog before the network call finishes (timeout is 4 s, so the window is real on a slow connection), the dialog — and with it the runningQThread— is garbage-collected. Qt aborts the process withQThread: Destroyed while thread is still running.Anchors:
bcc.py—_show_about(~L1503),AboutDialog._check_for_updates(~L1397),UpdateCheckWorker(~L166).Also:
_on_check_donesetsself._worker = Nonefrom the worker's owndonesignal; the thread may not have fully finished when the last reference drops. Same crash class.Proposed fix
AboutDialog.closeEvent/done(), if a worker is running: disconnect the signal andwait()(bounded) before dropping the reference; and in_on_check_done,self._worker.deleteLater()afterfinishedrather than dropping the Python reference immediately.Acceptance
fetch_latest_releasesleeping 3 s): noQThread: Destroyed while thread is still running, no crash.