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

Using borrowed object after destroying context causes segfault. #7

Open
vickenty opened this issue Sep 18, 2015 · 0 comments
Open

Using borrowed object after destroying context causes segfault. #7

vickenty opened this issue Sep 18, 2015 · 0 comments

Comments

@vickenty
Copy link

Demo.

While this is clearly a bug in the user code and current behaviour is not worse than that of the C library, a Python module can probably do better than crash the interpreter.

One way to fix this would be to add a Context reference to all Objects to ensure that context lives long enough. Another - to add a weak reference instead, so objects would be able to check if context is alive before making library calls and handle released context gracefully.

Personally, I think that the weakref approach would be better as it is more consistent with the style of the C API, even if it has slightly more overhead. What do you think?

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

No branches or pull requests

1 participant