From f0aff5e7ce63594f5714768836cc8b6e9c57fe5c Mon Sep 17 00:00:00 2001 From: DreamSourceLab Date: Fri, 25 Mar 2016 14:34:06 +0800 Subject: [PATCH] Fix memory release issue when added protocol decoder --- DSView/pv/data/decoderstack.cpp | 2 ++ DSView/pv/dock/protocoldock.cpp | 8 ++++---- DSView/pv/sigsession.cpp | 15 ++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index 1df0abb0..056bdfe7 100644 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -213,6 +213,8 @@ void DecoderStack::clear() void DecoderStack::stop_decode() { + _snapshot.reset(); + if(_decode_state == Stopped) return; diff --git a/DSView/pv/dock/protocoldock.cpp b/DSView/pv/dock/protocoldock.cpp index 37463923..7756af9e 100644 --- a/DSView/pv/dock/protocoldock.cpp +++ b/DSView/pv/dock/protocoldock.cpp @@ -103,10 +103,10 @@ int ProtocolDock::decoder_name_cmp(const void *a, const void *b) void ProtocolDock::paintEvent(QPaintEvent *) { - QStyleOption opt; - opt.init(this); - QPainter p(this); - style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + //QStyleOption opt; + //opt.init(this); + //QPainter p(this); + //style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } void ProtocolDock::add_protocol() diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index fb547f52..b4dfa217 100644 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -608,6 +608,13 @@ void SigSession::read_sample_rate(const sr_dev_inst *const sdi) void SigSession::feed_in_header(const sr_dev_inst *sdi) { +#ifdef ENABLE_DECODE + for (vector< boost::shared_ptr >::iterator i = + _decode_traces.begin(); + i != _decode_traces.end(); + i++) + (*i)->decoder()->stop_decode(); +#endif read_sample_rate(sdi); //receive_data(0); } @@ -1098,13 +1105,7 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi, _cur_dso_snapshot.reset(); _cur_analog_snapshot.reset(); } -#ifdef ENABLE_DECODE - for (vector< boost::shared_ptr >::iterator i = - _decode_traces.begin(); - i != _decode_traces.end(); - i++) - (*i)->decoder()->stop_decode(); -#endif + frame_ended(); break; }