Merge pull request #606 from KLayout/debug-basic_rba-crash

Fix candidate for MacOS rba:basic crash
This commit is contained in:
Matthias Köfferlein 2020-07-07 12:52:00 -07:00 committed by GitHub
commit c1e627b176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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