Skip to content

Commit

Permalink
TrainVehicleListItem: fix deleting item
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgit committed Nov 5, 2023
1 parent 37f1f4c commit 73532c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/src/train/trainvehiclelistitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ std::string TrainVehicleListItem::getObjectId() const

void TrainVehicleListItem::destroying()
{
//NOTE: we cannot normally set vehicle to nullptr (rejected by OnSet callback)
//So we mirror cleanup operations and manually reset value at end
if(vehicle)
disconnectVehicle(*vehicle.value());
vehicle = nullptr;
vehicle.setValueInternal(nullptr);

Object::destroying();
}
Expand Down

0 comments on commit 73532c3

Please sign in to comment.