X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=pv%2Fsession.cpp;h=ea3fe07b4e312c8bece64035967edf4e6e5c692f;hb=4d0f333acdcd747ffc542d77e679ce08af6031ae;hp=e42f730a4dc4d2900b6ee4e12f541f0c134ec0ee;hpb=533b67b7af83c96af2692bac127b0023cca4dbe7;p=pulseview.git diff --git a/pv/session.cpp b/pv/session.cpp index e42f730a..ea3fe07b 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -84,7 +84,6 @@ using std::string; using std::unique_lock; #endif using std::unique_ptr; -using std::unordered_set; using std::vector; using sigrok::Analog; @@ -106,6 +105,7 @@ using Gst::ElementFactory; using Gst::Pipeline; #endif +using pv::data::SignalGroup; using pv::util::Timestamp; using pv::views::trace::Signal; using pv::views::trace::AnalogSignal; @@ -116,6 +116,7 @@ namespace pv { shared_ptr Session::sr_context; Session::Session(DeviceManager &device_manager, QString name) : + shutting_down_(false), device_manager_(device_manager), default_name_(name), name_(name), @@ -127,8 +128,15 @@ Session::Session(DeviceManager &device_manager, QString name) : Session::~Session() { + shutting_down_ = true; + // Stop and join to the thread stop_capture(); + + for (SignalGroup* group : signal_groups_) { + group->clear(); + delete group; + } } DeviceManager& Session::device_manager() @@ -235,7 +243,7 @@ void Session::save_setup(QSettings &settings) const int view_id = 0; i = 0; - for (const shared_ptr vb : views_) { + for (const shared_ptr& vb : views_) { shared_ptr tv = dynamic_pointer_cast(vb); if (tv) { for (const shared_ptr& time_item : tv->time_items()) { @@ -501,14 +509,22 @@ void Session::set_device(shared_ptr device) // Remove all stored data and reset all views for (shared_ptr view : views_) { - view->clear_signals(); + view->clear_signalbases(); #ifdef ENABLE_DECODE view->clear_decode_signals(); #endif view->reset_view_state(); } + + for (SignalGroup* group : signal_groups_) { + group->clear(); + delete group; + } + signal_groups_.clear(); + for (const shared_ptr& d : all_signal_data_) d->clear(); + all_signal_data_.clear(); signalbases_.clear(); cur_logic_segment_.reset(); @@ -605,8 +621,12 @@ Session::input_format_options(vector user_spec, * data type. */ auto found = fmt_opts.find(key); - if (found == fmt_opts.end()) + if (found == fmt_opts.end()) { + qCritical() << "Supplied input option" << QString::fromStdString(key) << + "is not a valid option for this input module, it will be ignored!"; continue; + } + shared_ptr