]> sigrok.org Git - pulseview.git/commitdiff
Fix #775 by catching and handling the thrown exception
authorSoeren Apel <redacted>
Tue, 6 Jun 2017 17:46:00 +0000 (19:46 +0200)
committerSoeren Apel <redacted>
Tue, 6 Jun 2017 17:46:00 +0000 (19:46 +0200)
pv/session.cpp

index eec1a051b5a8838ba3f81b58c0759adbadb024a9..c18f809446a037475f4106e10576f3a89d5c1688 100644 (file)
@@ -849,7 +849,14 @@ void Session::sample_thread_proc(function<void (const QString)> error_handler)
        set_capture_state(device_->session()->trigger() ?
                AwaitingTrigger : Running);
 
        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
        set_capture_state(Stopped);
 
        // Confirm that SR_DF_END was received