summaryrefslogtreecommitdiff
path: root/src/lib/job.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-05-13 21:57:40 +0100
committerCarl Hetherington <cth@carlh.net>2015-05-13 21:57:40 +0100
commit05c37bfdb86be26497d5baa448a0cbda20e33bed (patch)
treefed504a9785d818940097810968b6cccb5780b3f /src/lib/job.cc
parent6718fb9d02d0b55ccd00eda8faa027972d46a4b4 (diff)
Fix crashes on x-thread signal emission.
Fix crashes on x-thread signal emission if the emitting object is destroyed between the storage of the message on the queue and the emission of the object in the UI thread.
Diffstat (limited to 'src/lib/job.cc')
-rw-r--r--src/lib/job.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/job.cc b/src/lib/job.cc
index eadafbf73..f28146632 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -203,8 +203,8 @@ Job::set_state (State s)
}
}
- if (finished && ui_signaller) {
- ui_signaller->emit (boost::bind (boost::ref (Finished)));
+ if (finished) {
+ emit (boost::bind (boost::ref (Finished)));
}
}
@@ -239,9 +239,7 @@ Job::set_progress (float p, bool force)
_pause_changed.wait (lm2);
}
- if (ui_signaller) {
- ui_signaller->emit (boost::bind (boost::ref (Progress)));
- }
+ emit (boost::bind (boost::ref (Progress)));
}
/** @return fractional progress of the current sub-job, if known */
@@ -301,9 +299,7 @@ Job::set_progress_unknown ()
_progress.reset ();
lm.unlock ();
- if (ui_signaller) {
- ui_signaller->emit (boost::bind (boost::ref (Progress)));
- }
+ emit (boost::bind (boost::ref (Progress)));
}
/** @return Human-readable status of this job */