Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9682dc6 commit 38b3f01Copy full SHA for 38b3f01
src/runtime/classderived.cs
@@ -75,7 +75,8 @@ internal ClassDerivedObject(Type tp) : base(tp)
75
// So we don't call PyObject_GC_Del here and instead we set the python
76
// reference to a weak reference so that the C# object can be collected.
77
GCHandle gc = GCHandle.Alloc(self, GCHandleType.Weak);
78
- Marshal.WriteIntPtr(self.pyHandle, ObjectOffset.magic(self.tpHandle), (IntPtr)gc);
+ int gcOffset = ObjectOffset.magic(Runtime.PyObject_TYPE(self.pyHandle));
79
+ Marshal.WriteIntPtr(self.pyHandle, gcOffset, (IntPtr)gc);
80
self.gcHandle.Free();
81
self.gcHandle = gc;
82
}
0 commit comments