@@ -79,6 +79,7 @@ static constexpr bool type_has_shared_from_this(const void *) {
7979}
8080
8181struct guarded_delete {
82+ // NOTE: PYBIND11_INTERNALS_VERSION needs to be bumped if changes are made to this struct.
8283 std::weak_ptr<void > released_ptr; // Trick to keep the smart_holder memory footprint small.
8384 std::function<void (void *)> del_fun; // Rare case.
8485 void (*del_ptr)(void *); // Common case.
@@ -126,6 +127,7 @@ guarded_delete make_guarded_builtin_delete(bool armed_flag) {
126127
127128template <typename T, typename D>
128129struct custom_deleter {
130+ // NOTE: PYBIND11_INTERNALS_VERSION needs to be bumped if changes are made to this struct.
129131 D deleter;
130132 explicit custom_deleter (D &&deleter) : deleter{std::forward<D>(deleter)} {}
131133 void operator ()(void *raw_ptr) { deleter (static_cast <T *>(raw_ptr)); }
@@ -144,6 +146,7 @@ inline bool is_std_default_delete(const std::type_info &rtti_deleter) {
144146}
145147
146148struct smart_holder {
149+ // NOTE: PYBIND11_INTERNALS_VERSION needs to be bumped if changes are made to this struct.
147150 const std::type_info *rtti_uqp_del = nullptr ;
148151 std::shared_ptr<void > vptr;
149152 bool vptr_is_using_noop_deleter : 1 ;
@@ -238,12 +241,12 @@ struct smart_holder {
238241 }
239242
240243 void reset_vptr_deleter_armed_flag (const get_guarded_delete_fn ggd_fn, bool armed_flag) const {
241- auto *vptr_del_ptr = ggd_fn (vptr);
242- if (vptr_del_ptr == nullptr ) {
244+ auto *gd = ggd_fn (vptr);
245+ if (gd == nullptr ) {
243246 throw std::runtime_error (
244247 " smart_holder::reset_vptr_deleter_armed_flag() called in an invalid context." );
245248 }
246- vptr_del_ptr ->armed_flag = armed_flag;
249+ gd ->armed_flag = armed_flag;
247250 }
248251
249252 // Caller is responsible for precondition: ensure_compatible_rtti_uqp_del<T, D>() must succeed.
0 commit comments