]> sigrok.org Git - pulseview.git/blobdiff - pv/views/decoder_output/view.cpp
Fix #1505 by always updating the DecodeTrace height when needed
[pulseview.git] / pv / views / decoder_output / view.cpp
index 325fa716db78bd1800bce41c249770aac009d28a..0f127c8751d72340530f0a940a407c255f725115 100644 (file)
 using pv::data::DecodeSignal;
 using pv::data::SignalBase;
 using pv::data::decode::Decoder;
-using pv::util::TimeUnit;
 using pv::util::Timestamp;
 
-using std::dynamic_pointer_cast;
-using std::numeric_limits;
 using std::shared_ptr;
 
 namespace pv {
@@ -56,7 +53,7 @@ const char* SaveTypeNames[SaveTypeCount] = {
        "Binary",
        "Hex Dump, plain",
        "Hex Dump, with offset",
-       "Hex Dump, complete"
+       "Hex Dump, canonical"
 };
 
 
@@ -135,10 +132,6 @@ View::View(Session &session, bool is_main_view, QMainWindow *parent) :
        reset_view_state();
 }
 
-View::~View()
-{
-}
-
 ViewType View::get_type() const
 {
        return ViewTypeDecoderOutput;
@@ -272,6 +265,8 @@ void View::save_data() const
                pair<size_t, size_t> selection = hex_view_->get_selection();
 
                vector<uint8_t> data;
+               data.resize(selection.second - selection.first + 1);
+
                signal_->get_merged_binary_data_chunks_by_offset(current_segment_, decoder_,
                        bin_class_id_, selection.first, selection.second, &data);
 
@@ -310,6 +305,8 @@ void View::save_data_as_hex_dump(bool with_offset, bool with_ascii) const
                pair<size_t, size_t> selection = hex_view_->get_selection();
 
                vector<uint8_t> data;
+               data.resize(selection.second - selection.first + 1);
+
                signal_->get_merged_binary_data_chunks_by_offset(current_segment_, decoder_,
                        bin_class_id_, selection.first, selection.second, &data);
 
@@ -470,7 +467,7 @@ void View::on_actionSave_triggered(QAction* action)
 
 void View::perform_delayed_view_update()
 {
-       if (!binary_data_exists_)
+       if (signal_ && !binary_data_exists_)
                if (signal_->get_binary_data_chunk_count(current_segment_, decoder_, bin_class_id_))
                        binary_data_exists_ = true;