Skip to content
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

Avoid panic in drop? #109

Open
bvssvni opened this issue Jan 26, 2015 · 3 comments
Open

Avoid panic in drop? #109

bvssvni opened this issue Jan 26, 2015 · 3 comments

Comments

@bvssvni
Copy link
Member

bvssvni commented Jan 26, 2015

There are couple places where it panics on drop, which will cause the task to be aborted.

https://github.com/PistonDevelopers/freetype-rs/blob/master/src/face.rs#L311-L324

https://github.com/PistonDevelopers/freetype-rs/blob/master/src/library.rs#L99-L108

@andrewrk
Copy link
Member

Panic on drop does not necessarily cause the task to be aborted. Abortion happens when the task is unwinding due to another panic. During this time destructors are called, and if another panic happens, then the task is aborted.

http://doc.rust-lang.org/reference.html#thread

@bvssvni
Copy link
Member Author

bvssvni commented Jan 28, 2015

@andrewrk Thanks for correcting me!

Perhaps we should print out to stderr instead on drop?

@andrewrk
Copy link
Member

stderr is better than stdout, but I think the panic is the correct behavior here. In normal circumstances, a drop could trigger a panic and that would be the expected behavior. In circumstances where the program is already panicking, it could trigger an abort, but even that is the right behavior if so many critical errors are happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants