Keep alive won't keep the objects alive beyond the scope of the method. #3320
Unanswered
OmerUygurOzer
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I asked the question here: https://stackoverflow.com/questions/69385813/pybind11-keep-alive-wont-keep-object-alive
But basically when I use a method with keep alive such as:
.def("QueueEvent", &EventManager::QueueEvent, pybind11::keep_alive<1, 2>())
the object still gets destroyed and I get a read access violation error. The object is being passed to c++ from python as follows:
The read access violation happens inside the Trigger event method. Here's the revelant code for EventManager.
my understanding is that , it should be kept alive beyond the scope of the method.
Beta Was this translation helpful? Give feedback.
All reactions