[TechDraw] prevent crash where user duplicates page without also duplicating dependencies

This commit is contained in:
mwganson
2021-09-06 13:20:29 -05:00
parent 1c8b803f9e
commit dfe02d4099
3 changed files with 26 additions and 1 deletions

View File

@@ -481,7 +481,11 @@ void MDIViewPage::fixOrphans(bool force)
m_view->removeQView(qv);
} else {
TechDraw::DrawPage* pp = qv->getViewObject()->findParentPage();
if (thisPage != pp) {
/** avoid crash where a view might have more than one parent page
* if the user duplicated the page without duplicating dependencies
*/
int numParentPages = qv->getViewObject()->countParentPages();
if (thisPage != pp && numParentPages == 1) {
m_view->removeQView(qv);
}
}