From: Soeren Apel Date: Thu, 14 Jun 2018 19:05:07 +0000 (+0200) Subject: Fix up change handler registration X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=99c4952654ae218a6b45ca61066deb4f81f68416;p=pulseview.git Fix up change handler registration Before, the mismatched registration/deregistration lead to crashes. Example: Load file, load another file into the same session, change any setting -> crash because first change notifier is called but invalid --- diff --git a/pv/views/trace/analogsignal.cpp b/pv/views/trace/analogsignal.cpp index 14870285..67459c8a 100644 --- a/pv/views/trace/analogsignal.cpp +++ b/pv/views/trace/analogsignal.cpp @@ -129,11 +129,6 @@ AnalogSignal::AnalogSignal( update_scale(); } -AnalogSignal::~AnalogSignal() -{ - GlobalSettings::remove_change_handler(this); -} - shared_ptr AnalogSignal::data() const { return base_->analog_data(); diff --git a/pv/views/trace/analogsignal.hpp b/pv/views/trace/analogsignal.hpp index 928407bc..19334ee2 100644 --- a/pv/views/trace/analogsignal.hpp +++ b/pv/views/trace/analogsignal.hpp @@ -74,8 +74,6 @@ private: public: AnalogSignal(pv::Session &session, shared_ptr base); - ~AnalogSignal(); - shared_ptr data() const; virtual void save_settings(QSettings &settings) const; diff --git a/pv/views/trace/trace.cpp b/pv/views/trace/trace.cpp index 5977bc2c..7d850112 100644 --- a/pv/views/trace/trace.cpp +++ b/pv/views/trace/trace.cpp @@ -68,6 +68,11 @@ Trace::Trace(shared_ptr channel) : settings.value(GlobalSettings::Key_View_ShowHoverMarker).toBool(); } +Trace::~Trace() +{ + GlobalSettings::remove_change_handler(this); +} + shared_ptr Trace::base() const { return base_; diff --git a/pv/views/trace/trace.hpp b/pv/views/trace/trace.hpp index 758b2e97..d6d53045 100644 --- a/pv/views/trace/trace.hpp +++ b/pv/views/trace/trace.hpp @@ -94,6 +94,7 @@ private: protected: Trace(shared_ptr channel); + ~Trace(); public: /**