Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/geertlitjens/ASAP
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertLitjens committed Feb 7, 2018
2 parents 7207044 + ef01135 commit 265fafc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
37 changes: 19 additions & 18 deletions ASAP/annotation/AnnotationWorkstationExtensionPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,24 +793,25 @@ void AnnotationWorkstationExtensionPlugin::deleteAnnotation(QtAnnotation* annota
QTreeWidgetItemIterator it(_treeWidget);
while (*it) {
if (annotation == (*it)->data(1, Qt::UserRole).value<QtAnnotation*>()) {
if (_viewer) {
_viewer->scene()->removeItem(annotation);
}
if (_annotationService) {
std::vector<std::shared_ptr<Annotation> > annots = _annotationService->getList()->getAnnotations();
int annotInd = std::find(annots.begin(), annots.end(), annotation->getAnnotation()) - annots.begin();
_annotationService->getList()->removeAnnotation(annotInd);
}

_annotToItem.remove(annotation);
_qtAnnotations.removeOne(annotation);
_selectedAnnotations.remove(annotation);
annotation->decoupleAnnotation();

(*it)->setSelected(false);
delete (*it);
_viewer->scene()->removeItem(annotation);
break;
if (_annotationService) {
std::vector<std::shared_ptr<Annotation> > annots = _annotationService->getList()->getAnnotations();
int annotInd = std::find(annots.begin(), annots.end(), annotation->getAnnotation()) - annots.begin();
_annotationService->getList()->removeAnnotation(annotInd);
}

_annotToItem.remove(annotation);
_qtAnnotations.removeOne(annotation);
_selectedAnnotations.remove(annotation);
(*it)->setSelected(false);
delete (*it);

// Interacts with the deleteLater, causing a race condition.
/*if (_viewer) {
_viewer->scene()->removeItem(annotation);
}*/
annotation->deleteLater();

break;
}
++it;
}
Expand Down
4 changes: 0 additions & 4 deletions ASAP/annotation/QtAnnotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ _lastClickedSecondCoordinateIndex(-1)
QtAnnotation::~QtAnnotation() {
}

void QtAnnotation::decoupleAnnotation(void) {
_annotation = nullptr;
}

std::shared_ptr<Annotation> QtAnnotation::getAnnotation() const {
return _annotation;
}
Expand Down
1 change: 0 additions & 1 deletion ASAP/annotation/QtAnnotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ANNOTATIONPLUGIN_EXPORT QtAnnotation : public QObject, public QGraphicsIte
void moveCoordinateBy(unsigned int index, const Point& moveBy);
void moveCoordinatesBy(const Point& moveBy);

void decoupleAnnotation(void);
std::shared_ptr<Annotation> getAnnotation() const;

virtual QRectF boundingRect() const = 0;
Expand Down

0 comments on commit 265fafc

Please sign in to comment.