protected override void OnSave(InterDomainContext context) { base.OnSave(context); System.Diagnostics.Debug.Assert(dict == GetObjectDict(pyHandle)); foreach (var attr in cache.Values) { Runtime.XIncref(attr.pyHandle); } // Decref twice in tp_clear, equilibrate them. Runtime.XIncref(dict); Runtime.XIncref(dict); // destroy the cache(s) foreach (var pair in cache) { if ((Runtime.PyDict_DelItemString(DictRef, pair.Key) == -1) && (Exceptions.ExceptionMatches(Exceptions.KeyError))) { // Trying to remove a key that's not in the dictionary // raises an error. We don't care about it. Runtime.PyErr_Clear(); } else if (Exceptions.ErrorOccurred()) { throw new PythonException(); } pair.Value.DecrRefCount(); } cache.Clear(); }
protected override void OnLoad(InterDomainContext context) { base.OnLoad(context); GCHandle gc = AllocGCHandle(TrackTypes.Wrapper); SetGCHandle(ObjectReference, TypeReference, gc); }
protected override void OnLoad(InterDomainContext context) { base.OnLoad(context); GCHandle gc = AllocGCHandle(TrackTypes.Wrapper); Marshal.WriteIntPtr(pyHandle, ObjectOffset.magic(tpHandle), (IntPtr)gc); }
protected override void OnSave(InterDomainContext context) { base.OnSave(context); if (unbound != null) { Runtime.XIncref(unbound.pyHandle); } Runtime.XIncref(doc); }
protected override void OnSave(InterDomainContext context) { base.OnSave(context); if (pyHandle != tpHandle) { IntPtr dict = GetObjectDict(pyHandle); Runtime.XIncref(dict); context.Storage.AddValue("dict", dict); } }
protected override void OnSave(InterDomainContext context) { base.OnSave(context); if (!this.IsClrMetaTypeInstance()) { IntPtr dict = GetObjectDict(pyHandle); Runtime.XIncref(dict); context.Storage.AddValue("dict", dict); } }
protected override void OnLoad(InterDomainContext context) { base.OnLoad(context); if (pyHandle != tpHandle) { IntPtr dict = context.Storage.GetValue <IntPtr>("dict"); SetObjectDict(pyHandle, dict); } gcHandle = AllocGCHandle(); SetGCHandle(ObjectReference, gcHandle); }
protected override void OnLoad(InterDomainContext context) { base.OnLoad(context); if (pyHandle != tpHandle) { IntPtr dict = context.Storage.GetValue <IntPtr>("dict"); SetObjectDict(pyHandle, dict); } gcHandle = AllocGCHandle(); Marshal.WriteIntPtr(pyHandle, TypeOffset.magic(), (IntPtr)gcHandle); }
internal static CLRObject Restore(object ob, IntPtr pyHandle, InterDomainContext context) { CLRObject co = new CLRObject() { inst = ob, pyHandle = pyHandle, tpHandle = Runtime.PyObject_TYPE(pyHandle) }; co.Load(context); return(co); }
protected override void OnSave(InterDomainContext context) { base.OnSave(context); System.Diagnostics.Debug.Assert(dict == GetObjectDict(pyHandle)); foreach (var attr in cache.Values) { Runtime.XIncref(attr.pyHandle); } // Decref twice in tp_clear, equilibrate them. Runtime.XIncref(dict); Runtime.XIncref(dict); }
protected override void OnLoad(InterDomainContext context) { base.OnLoad(context); SetObjectDict(pyHandle, dict); }
protected virtual void OnLoad(InterDomainContext context) { }
protected virtual void OnSave(InterDomainContext context) { }
internal void Load(InterDomainContext context) { OnLoad(context); }
protected override void OnSave(InterDomainContext context) { base.OnSave(context); Runtime.XIncref(target); Runtime.XIncref(targetType); }
protected override void OnSave(InterDomainContext context) { base.OnSave(context); Runtime.XIncref(pyHandle); }
protected override void OnLoad(InterDomainContext context) { base.OnLoad(context); SetupGc(); }
internal void Save(InterDomainContext context) { OnSave(context); }