diff --git a/DSView/pv/data/decode/row.cpp b/DSView/pv/data/decode/row.cpp index acab85bf..47425af6 100755 --- a/DSView/pv/data/decode/row.cpp +++ b/DSView/pv/data/decode/row.cpp @@ -22,6 +22,7 @@ #include "row.h" #include +#include namespace pv { namespace data { @@ -63,6 +64,8 @@ QString Row::title() const bool Row::operator<(const Row &other) const { + assert(_decoder); + return (_decoder < other._decoder) || (_decoder == other._decoder && _order < other._order); } diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index 1600d390..9964b117 100755 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -65,7 +65,7 @@ DecoderStack::DecoderStack(pv::SigSession *session, _no_memory = false; _mark_index = -1; _decoder_status = decoder_status; - _stask_stauts = NULL; + _stask_stauts = NULL; _stack.push_back(new decode::Decoder(dec)); @@ -595,7 +595,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod void DecoderStack::execute_decode_stack() { - srd_session *session; + srd_session *session = NULL; srd_decoder_inst *prev_di = NULL; uint64_t decode_start = 0; uint64_t decode_end = 0; @@ -655,6 +655,7 @@ void DecoderStack::execute_decode_stack() if (error) { g_free(error); } + srd_session_destroy(session); } @@ -683,7 +684,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *self) assert(d); if (st->_bStop){ - qDebug()<<"decode task was stoped."; + // qDebug()<<"decode task was stoped."; return; } if (d->_decoder_status == NULL){ diff --git a/DSView/pv/data/decoderstack.h b/DSView/pv/data/decoderstack.h index d5e0c18a..c3093196 100755 --- a/DSView/pv/data/decoderstack.h +++ b/DSView/pv/data/decoderstack.h @@ -193,7 +193,7 @@ private: uint64_t _sample_count; decode_task_status *_stask_stauts; - mutable std::mutex _output_mutex; + mutable std::mutex _output_mutex; friend class DecoderStackTest::TwoDecoderStack; }; diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index da710a2f..29de5dc6 100755 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -430,6 +430,10 @@ void SigSession::start_capture(bool instant) return; } + // stop all decode tasks + int run_dex = 0; + clear_all_decode_task(run_dex); + // stop previous capture stop_capture(); @@ -1366,7 +1370,12 @@ bool SigSession::add_decoder(srd_decoder *const dec, bool silent, DecoderStatus if (ret) { _decode_traces.push_back(trace); - add_decode_task(trace); + + //add decode task from ui + if (!silent){ + add_decode_task(trace); + } + signals_changed(); data_updated(); } @@ -1917,7 +1926,7 @@ void SigSession::set_stop_scale(float scale) //the decode task thread proc void SigSession::decode_task_proc(){ - //qDebug()<<"decode thread start"; + qDebug()<<"------->decode thread start"; auto task = get_top_decode_task(); while (task != NULL) @@ -1941,7 +1950,7 @@ void SigSession::set_stop_scale(float scale) task = get_top_decode_task(); } - // qDebug()<<"decode thread end"; + qDebug()<<"------->decode thread end"; _bDecodeRunning = false; } diff --git a/libsigrokdecode4DSL/instance.c b/libsigrokdecode4DSL/instance.c index a0f66be4..72fde30f 100755 --- a/libsigrokdecode4DSL/instance.c +++ b/libsigrokdecode4DSL/instance.c @@ -1229,8 +1229,9 @@ SRD_PRIV int srd_inst_decode(struct srd_decoder_inst *di, if (!di->thread_handle) { srd_dbg("No worker thread for this decoder stack " "exists yet, creating one: %s.", di->inst_id); + di->thread_handle = g_thread_new(di->inst_id, - di_thread, di); + di_thread, di); } /* Push the new sample chunk to the worker thread. */ diff --git a/libsigrokdecode4DSL/libsigrokdecode.h b/libsigrokdecode4DSL/libsigrokdecode.h index bf180b55..1129d5d8 100755 --- a/libsigrokdecode4DSL/libsigrokdecode.h +++ b/libsigrokdecode4DSL/libsigrokdecode.h @@ -349,7 +349,7 @@ struct srd_proto_data { uint64_t start_sample; uint64_t end_sample; struct srd_pd_output *pdo; - void *data; + void *data; }; struct srd_proto_data_annotation { int ann_class; diff --git a/libsigrokdecode4DSL/type_decoder.c b/libsigrokdecode4DSL/type_decoder.c index 94beaefa..ea74cca8 100755 --- a/libsigrokdecode4DSL/type_decoder.c +++ b/libsigrokdecode4DSL/type_decoder.c @@ -463,7 +463,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) uint64_t start_sample, end_sample; int output_id; struct srd_pd_callback *cb; - PyGILState_STATE gstate; + PyGILState_STATE gstate; py_data = NULL; //the fourth param from python