Candidate for fix.

This commit is contained in:
Matthias Koefferlein 2020-07-05 14:09:23 +02:00
parent 6365ddfe82
commit beec19951d
3 changed files with 16 additions and 2 deletions

View File

@ -306,7 +306,11 @@ PYAObjectBase::detach ()
}
}
detach_callbacks ();
// NOTE: m_owned = false might mean the C++ object is already destroyed. We must not
// modify in this case and without is_managed() there is no way of knowing the state.
if (m_owned) {
detach_callbacks ();
}
m_obj = 0;
m_const_ref = false;

View File

@ -402,7 +402,11 @@ Proxy::detach ()
}
}
clear_callbacks ();
// NOTE: m_owned = false might mean the C++ object is already destroyed. We must not
// modify in this case and without is_managed() there is no way of knowing the state.
if (m_owned) {
clear_callbacks ();
}
m_self = Qnil;
m_obj = 0;

View File

@ -1402,6 +1402,12 @@ class Basic_TestClass < TestBase
a._manage
end
# Looks like Ruby is keeping the last A instance in some kind of cache:
# this will release it
a = RBA::A.new
a._destroy
a = nil
# makes sure the objects inside the block before are deleted
GC.start