diff --git a/src/Mod/TechDraw/App/DrawView.cpp b/src/Mod/TechDraw/App/DrawView.cpp index 2abda6ef84..f8d4c46bb0 100644 --- a/src/Mod/TechDraw/App/DrawView.cpp +++ b/src/Mod/TechDraw/App/DrawView.cpp @@ -323,12 +323,7 @@ std::vector DrawView::findAllParentPages() const DrawViewCollection *collection = nullptr; std::vector parentsAll = getInList(); - //prune the duplicates - std::sort(parentsAll.begin(), parentsAll.end()); - auto last = std::unique(parentsAll.begin(), parentsAll.end()); - parentsAll.erase(last, parentsAll.end()); - - for (auto& parent : parentsAll) { + for (auto& parent : parentsAll) { if (parent->getTypeId().isDerivedFrom(DrawPage::getClassTypeId())) { page = static_cast(parent); } else if (parent->getTypeId().isDerivedFrom(DrawViewCollection::getClassTypeId())) { @@ -341,10 +336,14 @@ std::vector DrawView::findAllParentPages() const } } + //prune the duplicates + std::sort(result.begin(), result.end()); + auto last = std::unique(result.begin(), result.end()); + result.erase(last, result.end()); + return result; } - bool DrawView::isInClip() { std::vector parent = getInList();