File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,9 @@ class cpp_function : public function {
256
256
// / Register a function call with Python (generic non-templated code goes here)
257
257
void initialize_generic (unique_function_record &&unique_rec, const char *text,
258
258
const std::type_info *const *types, size_t args) {
259
+ // Do NOT receive `unique_rec` by value. If this function fails to move the unique_ptr, then
260
+ // we do not want this to destuct the pointer. `initialize` (the caller) still relies on the
261
+ // pointee being alive after this call. Only move if a `capsule` is going to keep it alive.
259
262
auto rec = unique_rec.get ();
260
263
261
264
// Keep track of strdup'ed strings, and clean them up as long as the function's capsule
You can’t perform that action at this time.
0 commit comments