Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Prevent choking when trying to serialize a multi-dispatch cache

  • Loading branch information...
commit 54921c8b94e8949de3860ae74a8d4be3fcabeff2 1 parent d0ee156
@sorear authored
Showing with 12 additions and 1 deletion.
  1. +1 −1  lib/NieczaCLR.cs
  2. +11 −0 lib/Serialize.cs
View
2  lib/NieczaCLR.cs
@@ -237,7 +237,7 @@ class CandidateSet : IFreeze {
void IFreeze.Freeze(FreezeBuffer fb) {
// anyone who holds a ref to one of these needs to recreate it.
- fb.Byte((byte) SerializationCode.Null);
+ fb.Ephemeralize();
}
}
View
11 lib/Serialize.cs
@@ -88,6 +88,12 @@ struct ObjRef {
return false;
}
+ // Undo previous method...
+ public void DeleteLastObject(SerUnit into) {
+ byref.Remove(into.bynum[--into.nobj]);
+ into.bynum[into.nobj] = null;
+ }
+
public void RegisterThawed(SerUnit into, object o) {
ObjRef or;
if (into.nobj == into.bynum.Length)
@@ -385,6 +391,11 @@ public class FreezeBuffer {
}
}
+ public void Ephemeralize() {
+ Byte((byte)SerializationCode.Null);
+ reg.DeleteLastObject(unit);
+ }
+
// This is the main routine you should call from your Freeze
// callbacks to freeze an object
public void ObjRef(object o) {
Please sign in to comment.
Something went wrong with that request. Please try again.