Made some progress, but then decided to revert back to yesterday
So now I know why smart pointers are discouraged! So my ownership model was really screwed up and super confusing and I had some crazy memory problems and segmentation faults so I reverted back to yesterdays commit and am going to refactor the code to use SMART POINTERS (wow) and have a better ownership model.
I feel pretty sad that I basically made no progress with 3 hours of work but I guess I learned something?
SO the new plan is that Layout class will handle all things that are static in simulation and are just there (roads and intersections, both physical/logical) and Simulation will only handle all the cars and driving around. The EditorWindow class will have a pointer to (but now own) Layout so it can modify Layout but not Simulation. The SimulationWindow class will have a smart pointer to (and own) a simulation (fresh) and PhysicalCar s. This should help clarify ownership and prevent memory management issues.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.