X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=inline;f=pv%2Fsession.cpp;h=c18f809446a037475f4106e10576f3a89d5c1688;hb=3ed18835d80218df744ec539946c2660fe5de812;hp=d7041d8ba2bea774e01cde16aabbd6e8b987f53b;hpb=aca9aa834c742ba70f49d1ac3eb2d1e02e759416;p=pulseview.git
diff --git a/pv/session.cpp b/pv/session.cpp
index d7041d8..c18f809 100644
--- a/pv/session.cpp
+++ b/pv/session.cpp
@@ -17,15 +17,10 @@
* along with this program; if not, see .
*/
-#ifdef _WIN32
-// Windows: Avoid boost/thread namespace pollution (which includes windows.h).
-#define NOGDI
-#define NORESOURCE
-#endif
-
#include
#include
+#include
#include
#include
@@ -77,6 +72,7 @@ using std::recursive_mutex;
using std::runtime_error;
using std::shared_ptr;
using std::string;
+using std::unique_ptr;
using std::unordered_set;
using std::vector;
@@ -853,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
@@ -981,12 +984,15 @@ void Session::feed_in_analog(shared_ptr analog)
const vector> channels = analog->channels();
const unsigned int channel_count = channels.size();
const size_t sample_count = analog->num_samples() / channel_count;
- const float *data = static_cast(analog->data_pointer());
bool sweep_beginning = false;
+ unique_ptr data(new float[analog->num_samples()]);
+ analog->get_data_as_float(data.get());
+
if (signalbases_.empty())
update_signals();
+ float *channel_data = data.get();
for (auto channel : channels) {
shared_ptr segment;
@@ -1020,7 +1026,7 @@ void Session::feed_in_analog(shared_ptr analog)
assert(segment);
// Append the samples in the segment
- segment->append_interleaved_samples(data++, sample_count,
+ segment->append_interleaved_samples(channel_data++, sample_count,
channel_count);
}