Skip to content

No copy constructor or assignment operator in BoidsSystem - Potential for shallow copy issues. #2

@ColePoppleton

Description

@ColePoppleton

The BoidsSystem class manages a QList named boids. The compiler automatically creates a default copy constructor and assignment operator. This could cause issues with memory management if BoidsSystem objects are copied, as the copy would point to the same QList, and deleting one copy would cause a double-free. Explicitly define a copy constructor and assignment operator for BoidsSystem. Implement deep copying of the boids list (creating new Boid objects for the copy) to avoid shallow copies. Alternatively, consider deleting the copy constructor and assignment operator if copying BoidsSystem objects is not intended to prevent such copies from being made in the first place.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions