QVariant AnnotationCollectionModel::headerData(int section, Qt::Orientation orientation,
int role) const
{
+ if ((section < 0) || (section >= (int)header_data_.size()))
+ return QVariant();
+
if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole))
- return header_data_.at(section);
+ return header_data_[section];
return QVariant();
}
return;
}
- disconnect(this, SLOT(on_annotation_visibility_changed()));
+ if (signal_)
+ for (const shared_ptr<Decoder>& dec : signal_->decoder_stack())
+ disconnect(dec.get(), nullptr, this, SLOT(on_annotation_visibility_changed()));
all_annotations_ = signal->get_all_annotations_by_segment(current_segment);
signal_ = signal;
connect(dec.get(), SIGNAL(annotation_visibility_changed()),
this, SLOT(on_annotation_visibility_changed()));
- if (hide_hidden_)
+ if (hide_hidden_) {
update_annotations_without_hidden();
- else
+ dataset_ = &all_annotations_without_hidden_;
+ } else
dataset_ = all_annotations_;
if (!dataset_ || dataset_->empty()) {
// 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)) {