From fe3f54c0747a4a36ff2554615a6df2c8d6c1f4ba Mon Sep 17 00:00:00 2001 From: Pablo Alvarez Lopez Date: Mon, 28 Oct 2024 11:51:20 +0100 Subject: [PATCH] Removed references to distribution frames. Fix #15642 --- src/netedit/GNENetHelper.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/netedit/GNENetHelper.cpp b/src/netedit/GNENetHelper.cpp index e9dc4a0ae5f9..7c017762b2d8 100644 --- a/src/netedit/GNENetHelper.cpp +++ b/src/netedit/GNENetHelper.cpp @@ -2548,6 +2548,7 @@ GNENetHelper::AttributeCarriers::insertDemandElement(GNEDemandElement* demandEle void GNENetHelper::AttributeCarriers::deleteDemandElement(GNEDemandElement* demandElement, const bool updateFrames) { const auto tag = demandElement->getTagProperty().getTag(); + auto viewParent = myNet->getViewNet()->getViewParent(); // find demanElement in demandElementTag auto itFind = myDemandElements.at(tag).find(demandElement->getGUIGlObject()); // check if demandElement was previously inserted @@ -2556,9 +2557,15 @@ GNENetHelper::AttributeCarriers::deleteDemandElement(GNEDemandElement* demandEle } // remove it from inspected elements and GNEElementTree myNet->getViewNet()->removeFromAttributeCarrierInspected(demandElement); - myNet->getViewNet()->getViewParent()->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(demandElement); - myNet->getViewNet()->getViewParent()->getPersonPlanFrame()->getPersonHierarchy()->removeCurrentEditedAttributeCarrier(demandElement); - myNet->getViewNet()->getViewParent()->getContainerPlanFrame()->getContainerHierarchy()->removeCurrentEditedAttributeCarrier(demandElement); + viewParent->getInspectorFrame()->getHierarchicalElementTree()->removeCurrentEditedAttributeCarrier(demandElement); + viewParent->getPersonPlanFrame()->getPersonHierarchy()->removeCurrentEditedAttributeCarrier(demandElement); + viewParent->getContainerPlanFrame()->getContainerHierarchy()->removeCurrentEditedAttributeCarrier(demandElement); + if (viewParent->getRouteDistributionFrame()->getDistributionSelector()->getCurrentDistribution() == demandElement) { + viewParent->getRouteDistributionFrame()->getDistributionSelector()->setDistribution(nullptr); + } + if (viewParent->getTypeDistributionFrame()->getDistributionSelector()->getCurrentDistribution() == demandElement) { + viewParent->getTypeDistributionFrame()->getDistributionSelector()->setDistribution(nullptr); + } // if is the last inserted route, remove it from GNEViewNet if (myNet->getViewNet()->getLastCreatedRoute() == demandElement) { myNet->getViewNet()->setLastCreatedRoute(nullptr);