-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Handle disposable objects propertly #266
Conversation
98b2e71
to
eec90a7
Compare
eec90a7
to
b4fe5f3
Compare
This might be a stupid suggestion, but instead of replacing the hundreds of references to |
It seems to me like it would be better to rework these situations rather than changing every single reference to Would something like a |
Since |
Although now that I think about it, |
b4fe5f3
to
bfa729c
Compare
Thank you for implementing this! 🙂 |
Description
Currently, SFML.Net has no checks for whenever an object is disposed (i.e. its CPointer is set to IntPtr.Zero), and will call methods and getters without complaining (before promptly crashing).
The main reasons why this is not great are:
Solving this issue isn't too hard, but adds checks across the entire codebase:
How to test?
Run each of the example projects and make sure they don't crash for normal objects (i.e. not disposed.)
Additionally, run code similar to this one in a debugger session to make sure disposed objects can be visualized correctly in Locals / Watch: