| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -300,7 +300,6 @@ public static int tp_clear(IntPtr ob) | |||
| 300 | 300 | ClearObjectDict(ob); | |
| 301 | 301 | } | |
| 302 | 302 | self.tpHandle = IntPtr.Zero; | |
| 303 | - Runtime.Py_CLEAR(ref self.tpHandle); | ||
| 304 | 303 | return 0; | |
| 305 | 304 | } | |
| 306 | 305 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,8 +29,7 @@ internal class ConstructorBinding : ExtensionType | |||
| 29 | 29 | public ConstructorBinding(Type type, IntPtr pyTypeHndl, ConstructorBinder ctorBinder) | |
| 30 | 30 | { | |
| 31 | 31 | this.type = type; | |
| 32 | - Runtime.XIncref(pyTypeHndl); | ||
| 33 | - this.pyTypeHndl = pyTypeHndl; | ||
| 32 | + this.pyTypeHndl = pyTypeHndl; // steal a type reference | ||
| 34 | 33 | this.ctorBinder = ctorBinder; | |
| 35 | 34 | repr = IntPtr.Zero; | |
| 36 | 35 | } | |
@@ -144,7 +143,6 @@ public static IntPtr tp_repr(IntPtr ob) | |||
| 144 | 143 | { | |
| 145 | 144 | var self = (ConstructorBinding)GetManagedObject(ob); | |
| 146 | 145 | Runtime.XDecref(self.repr); | |
| 147 | - Runtime.XDecref(self.pyTypeHndl); | ||
| 148 | 146 | self.Dealloc(); | |
| 149 | 147 | } | |
| 150 | 148 | ||
@@ -179,8 +177,7 @@ internal class BoundContructor : ExtensionType | |||
| 179 | 177 | public BoundContructor(Type type, IntPtr pyTypeHndl, ConstructorBinder ctorBinder, ConstructorInfo ci) | |
| 180 | 178 | { | |
| 181 | 179 | this.type = type; | |
| 182 | - Runtime.XIncref(pyTypeHndl); | ||
| 183 | - this.pyTypeHndl = pyTypeHndl; | ||
| 180 | + this.pyTypeHndl = pyTypeHndl; // steal a type reference | ||
| 184 | 181 | this.ctorBinder = ctorBinder; | |
| 185 | 182 | ctorInfo = ci; | |
| 186 | 183 | repr = IntPtr.Zero; | |
@@ -241,7 +238,6 @@ public static IntPtr tp_repr(IntPtr ob) | |||
| 241 | 238 | { | |
| 242 | 239 | var self = (BoundContructor)GetManagedObject(ob); | |
| 243 | 240 | Runtime.XDecref(self.repr); | |
| 244 | - Runtime.XDecref(self.pyTypeHndl); | ||
| 245 | 241 | self.Dealloc(); | |
| 246 | 242 | } | |
| 247 | 243 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -515,17 +515,6 @@ internal static ThunkInfo GetThunk(MethodInfo method, string funcType = null) | |||
| 515 | 515 | } | |
| 516 | 516 | ||
| 517 | 517 | ||
| 518 | - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] | ||
| 519 | - internal struct Thunk | ||
| 520 | - { | ||
| 521 | - public Delegate fn; | ||
| 522 | - | ||
| 523 | - public Thunk(Delegate d) | ||
| 524 | - { | ||
| 525 | - fn = d; | ||
| 526 | - } | ||
| 527 | - } | ||
| 528 | - | ||
| 529 | 518 | internal class ThunkInfo | |
| 530 | 519 | { | |
| 531 | 520 | public readonly Delegate Target; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,6 +53,7 @@ public ModuleObject(string name) | |||
| 53 | 53 | Runtime.XDecref(pyfilename); | |
| 54 | 54 | Runtime.XDecref(pydocstring); | |
| 55 | 55 | ||
| 56 | + Runtime.XIncref(dict); | ||
| 56 | 57 | Marshal.WriteIntPtr(pyHandle, ObjectOffset.DictOffset(pyHandle), dict); | |
| 57 | 58 | ||
| 58 | 59 | InitializeModuleMembers(); | |
@@ -328,8 +329,8 @@ public static int tp_traverse(IntPtr ob, IntPtr visit, IntPtr arg) | |||
| 328 | 329 | public static int tp_clear(IntPtr ob) | |
| 329 | 330 | { | |
| 330 | 331 | var self = (ModuleObject)GetManagedObject(ob); | |
| 331 | - Runtime.XDecref(self.dict); | ||
| 332 | - self.dict = IntPtr.Zero; | ||
| 332 | + Runtime.Py_CLEAR(ref self.dict); | ||
| 333 | + ClearObjectDict(ob); | ||
| 333 | 334 | foreach (var attr in self.cache.Values) | |
| 334 | 335 | { | |
| 335 | 336 | Runtime.XDecref(attr.pyHandle); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1112,9 +1112,6 @@ private void ResetSlots() | |||
| 1112 | 1112 | Runtime.XDecref(tp_bases); | |
| 1113 | 1113 | tp_bases = Runtime.PyTuple_New(0); | |
| 1114 | 1114 | Marshal.WriteIntPtr(_type, TypeOffset.tp_bases, tp_bases); | |
| 1115 | - | ||
| 1116 | - // FIXME: release dict; | ||
| 1117 | - Marshal.WriteIntPtr(_type, TypeOffset.tp_dictoffset, IntPtr.Zero); | ||
| 1118 | 1115 | } | |
| 1119 | 1116 | ||
| 1120 | 1117 | private static void OnDestruct(IntPtr ob) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments