From: Soeren Apel Date: Sat, 12 Dec 2020 21:47:45 +0000 (+0100) Subject: Fix remaining invalid disconnect() calls X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1804b9700b7ac1314e0e9b59555170a6d10108e0;p=pulseview.git Fix remaining invalid disconnect() calls --- diff --git a/pv/data/mathsignal.cpp b/pv/data/mathsignal.cpp index f7de2ff2..adb27131 100644 --- a/pv/data/mathsignal.cpp +++ b/pv/data/mathsignal.cpp @@ -307,8 +307,13 @@ void MathSignal::begin_generation() return; } - disconnect(this, SLOT(on_data_received())); - disconnect(this, SLOT(on_enabled_changed())); + disconnect(&session_, SIGNAL(data_received()), this, SLOT(on_data_received())); + + for (const shared_ptr& sb : session_.signalbases()) { + if (sb->analog_data()) + disconnect(sb->analog_data().get(), nullptr, this, SLOT(on_data_received())); + disconnect(sb.get(), nullptr, this, SLOT(on_enabled_changed())); + } fnc_sample_ = new fnc_sample(*this); @@ -371,8 +376,7 @@ void MathSignal::begin_generation() if (error_message_.isEmpty()) { // Connect to the session data notification if we have no input signals if (input_signals_.empty()) - connect(&session_, SIGNAL(data_received()), - this, SLOT(on_data_received())); + connect(&session_, SIGNAL(data_received()), this, SLOT(on_data_received())); gen_interrupt_ = false; gen_thread_ = std::thread(&MathSignal::generation_proc, this); diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index b35e1466..39c290df 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -548,7 +548,7 @@ void MainBar::update_device_config_widgets() sample_count_supported_ = true; // Add notification of reconfigure events - disconnect(this, SLOT(on_config_changed())); + // Note: No need to disconnect the previous signal as that QObject instance is destroyed connect(&opts->binding(), SIGNAL(config_changed()), this, SLOT(on_config_changed())); diff --git a/pv/views/tabular_decoder/model.cpp b/pv/views/tabular_decoder/model.cpp index e7a199f1..337f4ce9 100644 --- a/pv/views/tabular_decoder/model.cpp +++ b/pv/views/tabular_decoder/model.cpp @@ -228,7 +228,8 @@ void AnnotationCollectionModel::set_signal_and_segment(data::DecodeSignal* signa return; } - disconnect(this, SLOT(on_annotation_visibility_changed())); + for (const shared_ptr& dec : signal_->decoder_stack()) + disconnect(dec.get(), nullptr, this, SLOT(on_annotation_visibility_changed())); all_annotations_ = signal->get_all_annotations_by_segment(current_segment); signal_ = signal;