From: Soeren Apel Date: Tue, 6 Jun 2017 17:46:00 +0000 (+0200) Subject: Fix #775 by catching and handling the thrown exception X-Git-Tag: pulseview-0.4.0~22 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=dc4ada2bfd5d9f4386661ffbf7ff3ad000b6bfb5;ds=sidebyside Fix #775 by catching and handling the thrown exception --- diff --git a/pv/session.cpp b/pv/session.cpp index eec1a051..c18f8094 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -849,7 +849,14 @@ void Session::sample_thread_proc(function error_handler) set_capture_state(device_->session()->trigger() ? AwaitingTrigger : Running); - device_->run(); + try { + device_->run(); + } catch (Error e) { + error_handler(e.what()); + set_capture_state(Stopped); + return; + } + set_capture_state(Stopped); // Confirm that SR_DF_END was received