X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Ftabular_decoder%2Fview.cpp;h=4f4c6238b02927e6d699417b4ea6184a3b196d1a;hp=069e55a02e8189a945d49ccc96a91e278b2c0ca9;hb=02c87df7336eb81b770457b4153cf2dc649ffdab;hpb=f54e68b03d5d24c7787962fcc701d8d52b0ec8ab diff --git a/pv/views/tabular_decoder/view.cpp b/pv/views/tabular_decoder/view.cpp index 069e55a0..4f4c6238 100644 --- a/pv/views/tabular_decoder/view.cpp +++ b/pv/views/tabular_decoder/view.cpp @@ -273,8 +273,10 @@ void View::save_data() const void View::on_selected_decoder_changed(int index) { - if (signal_) + if (signal_) { disconnect(signal_, SIGNAL(new_annotations())); + disconnect(signal_, SIGNAL(decode_reset())); + } reset_data(); @@ -286,8 +288,10 @@ void View::on_selected_decoder_changed(int index) if (decoder_ == dec.get()) signal_ = ds.get(); - if (signal_) + if (signal_) { connect(signal_, SIGNAL(new_annotations()), this, SLOT(on_new_annotations())); + connect(signal_, SIGNAL(decode_reset()), this, SLOT(on_decoder_reset())); + } update_data(); } @@ -319,6 +323,13 @@ void View::on_new_annotations() delayed_view_updater_.start(); } +void View::on_decoder_reset() +{ + // Invalidate the model's data connection immediately - otherwise we + // will use a stale pointer in model_->index() when called from the table view + model_->set_signal_and_segment(signal_, current_segment_); +} + void View::on_decoder_stacked(void* decoder) { Decoder* d = static_cast(decoder);