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

Must call Py_INCREF on bpy_mesh_ptr #17

Closed
SausageTaste opened this issue Jun 25, 2022 · 1 comment
Closed

Must call Py_INCREF on bpy_mesh_ptr #17

SausageTaste opened this issue Jun 25, 2022 · 1 comment

Comments

@SausageTaste
Copy link
Owner

SausageTaste commented Jun 25, 2022

auto bpy_mesh = ::PythonObject{bpy_mesh_ptr, true};

The bpy_mesh_ptr is borrowed reference, and it may be destroyed while std::async is using it.
Calling Py_INCREF(bpy_mesh_ptr) before the line will fix the problem.

On the other hand, Py_DECREF is not necessary.
Note the second arguemnt true in the ::PythonObject constructor.

@SausageTaste SausageTaste changed the title Must call Py_INCREF on bpy_mesh_ptr before this line Must call Py_INCREF on bpy_mesh_ptr Jun 25, 2022
@SausageTaste
Copy link
Owner Author

I was blind that I didn't see it was there alerady.

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