-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using particle
field in move/copy constructors of MapNode
#32
Comments
particle
field using in move constuctors of MapNode
particle
field in move constructors of MapNode
particle
field in move constructors of MapNode
particle
field in move/copy constructors of MapNode
In fact, it turns out like |
I thought about it a bit and have changed my mind. Even though Unfortunately, the application is not designed well enough: it pretends object-oriented, however, there is no one good interface for interaction with simulation ( So, the perfect way I see is to change |
This should also be fixed for other classes. For example, we have a line
which is likely to fail, because the destructor will be called for the invalid object |
The solution I see is adding default constructors for our classes. With them existing it would be possible to use the operator Another idea I came up with while writing the above is to create a @tanya-kta, what do you think? Which of these three (default constructor + |
I have chosen to add fake default constructors to the classes (replacing all the |
Removed the `.detach_particle()` line, mentioned in #32
Because it's not possible to allocate an array of
MapNodes
with the operatornew[]
when using an array ofMapNode
s user will face a problem: when trying to replace an element of the array with anotherMapNode
object, the destructor will be called for the old object, which was never constructed (but instead was allocated withmalloc
or created in any other c-style way) and, therefore, has theparticle
field invalidated. When the destructor is called, it tries todelete
a particle by theparticle
address, which is invalid. This results in an error.The workaround is to call the
detach_particle()
method before replacing an array object, but it looks ugly and should be fixed on theMapNode
class sideminds_crawl/src/simulation_objects/SimulationMap.cu
Line 246 in e150e17
Also, the call to
detach_particle()
in the above piece of code must be commented. It looks absolutely out of place without a commentThe text was updated successfully, but these errors were encountered: