]> sigrok.org Git - pulseview.git/commitdiff
TabularDecView: Try to handle a race condition in the model
authorSoeren Apel <redacted>
Tue, 23 Jun 2020 18:31:10 +0000 (20:31 +0200)
committerSoeren Apel <redacted>
Thu, 25 Jun 2020 19:05:38 +0000 (21:05 +0200)
pv/views/tabular_decoder/model.cpp

index 110cfd62b98d2280acea700a1ce130a50eb5f5a3..b87bf05869ef1f118ad69853ff3899ec4e1d097a 100644 (file)
@@ -324,9 +324,9 @@ QModelIndex AnnotationCollectionModel::update_highlighted_rows(QModelIndex first
                // we would need to highlight - only then do we do so
                QModelIndex index = first;
                do {
-                       const Annotation* ann =
-                               static_cast<const Annotation*>(index.internalPointer());
-                       assert(ann);
+                       const Annotation* ann = static_cast<const Annotation*>(index.internalPointer());
+                       if (!ann)  // Can happen if the table is being modified at this exact time
+                               return result;
 
                        if (((int64_t)ann->start_sample() <= sample_num) &&
                                ((int64_t)ann->end_sample() >= sample_num)) {