2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 04:22:16 +00:00

dynamic_cast before destructor

Call to the destructor ends lifetime of the object, including vptr
used by dynamic_cast.
This commit is contained in:
Vitaly Buka
2022-06-03 20:49:17 -07:00
committed by Stefan Seefeld
parent b988d70207
commit ff0ae9b29d

View File

@@ -333,8 +333,9 @@ namespace objects
for (instance_holder* p = kill_me->objects, *next; p != 0; p = next)
{
next = p->next();
void* q = dynamic_cast<void*>(p);
p->~instance_holder();
instance_holder::deallocate(inst, dynamic_cast<void*>(p));
instance_holder::deallocate(inst, q);
}
// Python 2.2.1 won't add weak references automatically when