8000 Avoid double dealloc · pythonnet/pythonnet@de7e1ac · GitHub
[go: up one dir, main page]

Skip to content

Commit de7e1ac

Browse files
committed
Avoid double dealloc
1 parent 0779aa3 commit de7e1ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/runtime/classderived.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ internal ClassDerivedObject(Type tp) : base(tp)
6767
{
6868
var self = (CLRObject)GetManagedObject(ob);
6969

70+
if (self.tpHandle == IntPtr.Zero)
71+
{
72+
ClassBase.tp_dealloc(ob);
73+
return;
74+
}
75+
7076
// don't let the python GC destroy this object
7177
Runtime.PyObject_GC_UnTrack(self.pyHandle);
7278

0 commit comments

Comments
 (0)
0