Skip to content

Commit 56926f6

Browse files
committed
Update lock scope when delete unique_ptr
1 parent 79a80d2 commit 56926f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/pybind11/detail/internals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ class internals_pp_manager {
700700
{
701701
std::lock_guard<std::mutex> lock(pp_set_mutex_);
702702
pps_have_created_content_.erase(tpp); // untrack deleted pp
703-
delete tpp;
704703
}
704+
delete tpp; // may call back into Python
705705
}
706706
unref();
707707
return;
@@ -710,8 +710,8 @@ class internals_pp_manager {
710710
{
711711
std::lock_guard<std::mutex> lock(pp_set_mutex_);
712712
pps_have_created_content_.erase(internals_singleton_pp_); // untrack deleted pp
713-
delete internals_singleton_pp_;
714713
}
714+
delete internals_singleton_pp_; // may call back into Python
715715
unref();
716716
}
717717

0 commit comments

Comments
 (0)