]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decode/decoder.cpp
Fix some DecodeTrace UI issues
[pulseview.git] / pv / data / decode / decoder.cpp
index 3769f8898f18fc7736691c4288fde9b175f5c206..99118d1707e5361e9f9449fbb6b24e18b1cd61f1 100644 (file)
@@ -76,9 +76,13 @@ Decoder::Decoder(const srd_decoder *const dec) :
                        ann_classes_.at((size_t)cl->data).row = &(rows_.back());
        }
 
-       if (rows_.empty())
+       if (rows_.empty()) {
                // Make sure there is a row for PDs without row declarations
-               rows_.emplace_back(0, this);
+               rows_.push_back({0, this});
+
+               for (AnnotationClass& c : ann_classes_)
+                       c.row = &(rows_.back());
+       }
 }
 
 Decoder::~Decoder()
@@ -242,6 +246,16 @@ vector<const AnnotationClass*> Decoder::ann_classes() const
        return result;
 }
 
+vector<AnnotationClass*> Decoder::ann_classes()
+{
+       vector<AnnotationClass*> result;
+
+       for (AnnotationClass& c : ann_classes_)
+               result.push_back(&c);
+
+       return result;
+}
+
 AnnotationClass* Decoder::get_ann_class_by_id(size_t id)
 {
        if (id >= ann_classes_.size())