diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-02-11 00:18:40 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-02-11 00:18:40 +0000 |
| commit | beea3beacba34c11b6b73323f4c3c8590a9aa73e (patch) | |
| tree | 70c7507dff9e52bddbe1052129e408a4b1df3764 /src/lib/writer.cc | |
| parent | b45f90d8d504c15b60d2ae3a3344e8beb2947f8a (diff) | |
Basic attempt to catch exceptions in the writer thread and pass them safely back to the GUI.
Diffstat (limited to 'src/lib/writer.cc')
| -rw-r--r-- | src/lib/writer.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 1df8a4301..8a09f254b 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -85,7 +85,7 @@ Writer::Writer (shared_ptr<Film> f) _sound_asset_writer = _sound_asset->start_write (); } - + _thread = new boost::thread (boost::bind (&Writer::thread, this)); } @@ -130,6 +130,7 @@ Writer::write (shared_ptr<const AudioBuffers> audio) void Writer::thread () +try { while (1) { @@ -221,7 +222,10 @@ Writer::thread () --_queued_full_in_memory; } } - +} +catch (...) +{ + store_current (); } void @@ -237,6 +241,10 @@ Writer::finish () lock.unlock (); _thread->join (); + if (thrown ()) { + rethrow (); + } + delete _thread; _thread = 0; @@ -361,7 +369,6 @@ Writer::can_fake_write (int frame) const return (frame != 0 && frame < _first_nonexistant_frame); } - bool operator< (QueueItem const & a, QueueItem const & b) { |
