From 22de2d803ad1cb7b9975dd622ba8f269fbff7dd3 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 5 Mar 2012 14:09:42 -0500 Subject: [PATCH] [#196 state:fixed] [#188] Fixed a crash on crash reporting under Cocoa and improved job management to allow threaded error handling on _job_finished(). --- cocoa/inter/app.py | 4 +++- core/app.py | 7 ++++--- qt/base/app.py | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cocoa/inter/app.py b/cocoa/inter/app.py index 54aa9238..d04a4244 100644 --- a/cocoa/inter/app.py +++ b/cocoa/inter/app.py @@ -168,7 +168,9 @@ class PyDupeGuruBase(PyFairware): self.progress.job_cancelled = True def jobCompleted_(self, jobid: str): - self.model._job_completed(jobid) + result = self.model._job_completed(jobid, self.progress.last_error) + if not result: + self.progress.reraise_if_error() #--- model --> view @dontwrap diff --git a/core/app.py b/core/app.py index a3fbdc12..5299097c 100644 --- a/core/app.py +++ b/core/app.py @@ -169,13 +169,14 @@ class DupeGuru(RegistrableApplication, Broadcaster): if self.results.get_group_of_duplicate(d) is not None] self.notify('results_changed') - def _job_completed(self, jobid): - # Must be called by subclasses when they detect that an async job is completed. + def _job_completed(self, jobid, exc): + # Must be called by subclasses when they detect that an async job is completed. If an + # exception was raised during the job, `exc` will be set. Return True when the error was + # handled. If we return False when exc is set, a the exception will be re-raised. if jobid == JobType.Scan: self._results_changed() elif jobid in {JobType.Load, JobType.Move, JobType.Delete}: self._results_changed() - if jobid in {JobType.Copy, JobType.Move, JobType.Delete}: self.notify('problems_changed') diff --git a/qt/base/app.py b/qt/base/app.py index 8536dd82..4c85424a 100644 --- a/qt/base/app.py +++ b/qt/base/app.py @@ -200,7 +200,9 @@ class DupeGuru(QObject): QProcess.execute('updater.exe', ['/checknow']) def job_finished(self, jobid): - self.model._job_completed(jobid) + result = self.model._job_completed(jobid, self._progress.last_error) + if not result: + self._progress.reraise_if_error() if jobid in {JobType.Move, JobType.Copy, JobType.Delete}: if self.model.results.problems: self.problemDialog.show()