-
Notifications
You must be signed in to change notification settings - Fork 17
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
Potential lifetime issue with net(s) #13
Comments
E.g. this should do the trick: header:
code:
|
Thanks for the heads up ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
net
holds a pointer topcb
In c_pcb.cpp
best_pcb
is copy-constructed fromcurrent_pcb
. Shouldcurrent_pcb
go out of scope,best_pcb
would become compromised and result in segfaults when calling methods which would require thenet
-s it contains to refer to thepcb
pointers inside them, as thepcb
pointers are always pointing tocurrent_pcb
. While this works the way it is used, this architecture is brittle and unintuitive. I would suggest implementing a copy-constructor forpcb
which would correctly updatenets
to contain pointers to the new instance. Hope this is intelligible.The text was updated successfully, but these errors were encountered: