Skip to content

Commit d7df566

Browse files
committed
fix #17637
1 parent b61d130 commit d7df566

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

src/guisim/GUIVehicle.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ GUIVehicle::GUIVehicle(SUMOVehicleParameter* pars, ConstMSRoutePtr route,
9595

9696
GUIVehicle::~GUIVehicle() {
9797
gSelected.deselect(GLO_VEHICLE, getGlID());
98+
cleanupOnDestruction();
9899
}
99100

100101

src/mesogui/GUIMEVehicle.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ GUIMEVehicle::GUIMEVehicle(SUMOVehicleParameter* pars, ConstMSRoutePtr route,
5555
#endif
5656

5757

58-
GUIMEVehicle::~GUIMEVehicle() { }
58+
GUIMEVehicle::~GUIMEVehicle() {
59+
gSelected.deselect(GLO_VEHICLE, getGlID());
60+
cleanupOnDestruction();
61+
}
5962

6063

6164
GUIParameterTableWindow*

src/utils/gui/globjects/GUIGlObject.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,19 @@ GUIGlObject::GUIGlObject(GUIGlObjectType type, const std::string& microsimID, FX
191191

192192

193193
GUIGlObject::~GUIGlObject() {
194+
cleanupOnDestruction();
195+
GUIGlObjectStorage::gIDStorage.remove(getGlID());
196+
}
197+
198+
199+
void
200+
GUIGlObject::cleanupOnDestruction() {
194201
// remove all paramWindow related with this object
195202
for (const auto& paramWindow : myParamWindows) {
196203
paramWindow->removeObject(this);
197204
}
198205
// remove object from GLObjectValuePassConnector and GUIGlObjectStorage
199206
GLObjectValuePassConnector<double>::removeObject(*this);
200-
GUIGlObjectStorage::gIDStorage.remove(getGlID());
201207
}
202208

203209

src/utils/gui/globjects/GUIGlObject.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ class GUIGlObject {
313313
/// @brief build basic additional popup options. Used to unify pop-ups menu in netedit and SUMO-GUI
314314
void buildAdditionalsPopupOptions(GUIMainWindow& app, GUIGLObjectPopupMenu* ret, const std::string& type);
315315

316+
/// @brief to be called by child class to ensure cleanup in correct order
317+
void cleanupOnDestruction();
318+
316319
private:
317320
/// @brief The numerical id of the object
318321
const GUIGlID myGlID;

0 commit comments

Comments
 (0)