]> sigrok.org Git - pulseview.git/commitdiff
Fix up change handler registration
authorSoeren Apel <redacted>
Thu, 14 Jun 2018 19:05:07 +0000 (21:05 +0200)
committerUwe Hermann <redacted>
Sat, 16 Jun 2018 10:56:31 +0000 (12:56 +0200)
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

pv/views/trace/analogsignal.cpp
pv/views/trace/analogsignal.hpp
pv/views/trace/trace.cpp
pv/views/trace/trace.hpp

index 14870285fd144da5314ce914bd87b5935d846ef8..67459c8ab5d7f80a570b9c6554ef092effe50ae8 100644 (file)
@@ -129,11 +129,6 @@ AnalogSignal::AnalogSignal(
        update_scale();
 }
 
-AnalogSignal::~AnalogSignal()
-{
-       GlobalSettings::remove_change_handler(this);
-}
-
 shared_ptr<pv::data::SignalData> AnalogSignal::data() const
 {
        return base_->analog_data();
index 928407bc31bca2b362faa0d65dbd53d18aff8d19..19334ee289e08ee049736ff2218da59308cebff5 100644 (file)
@@ -74,8 +74,6 @@ private:
 public:
        AnalogSignal(pv::Session &session, shared_ptr<data::SignalBase> base);
 
-       ~AnalogSignal();
-
        shared_ptr<pv::data::SignalData> data() const;
 
        virtual void save_settings(QSettings &settings) const;
index 5977bc2c5c701c59bb0901274b6de6534fe0d377..7d8501122753aabe9f4d739d2dbea82d211fab5b 100644 (file)
@@ -68,6 +68,11 @@ Trace::Trace(shared_ptr<data::SignalBase> channel) :
                settings.value(GlobalSettings::Key_View_ShowHoverMarker).toBool();
 }
 
+Trace::~Trace()
+{
+       GlobalSettings::remove_change_handler(this);
+}
+
 shared_ptr<data::SignalBase> Trace::base() const
 {
        return base_;
index 758b2e97c46e0142238b842e8b3d42c013fda747..d6d53045e4bbf69ce68aff934a94195280a40d38 100644 (file)
@@ -94,6 +94,7 @@ private:
 
 protected:
        Trace(shared_ptr<data::SignalBase> channel);
+       ~Trace();
 
 public:
        /**