From 58ec0e4594d2cd112e9da5ba1d5f764edc35290f Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Sat, 15 Oct 2016 20:57:56 -0500 Subject: [PATCH] Add OF_Transient flag for objects that shouldn't be written to disk --- src/dobject.h | 4 ++++ src/serializer.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dobject.h b/src/dobject.h index 51102bc4c2..91a80f9d07 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -201,6 +201,7 @@ enum EObjectFlags OF_EuthanizeMe = 1 << 5, // Object wants to die OF_Cleanup = 1 << 6, // Object is now being deleted by the collector OF_YesReallyDelete = 1 << 7, // Object is being deleted outside the collector, and this is okay, so don't print a warning + OF_Transient = 1 << 11, // Object should not be archived (references to it will be nulled on disk) OF_WhiteBits = OF_White0 | OF_White1, OF_MarkBits = OF_WhiteBits | OF_Black, @@ -573,6 +574,9 @@ protected: } }; +// When you write to a pointer to an Object, you must call this for +// proper bookkeeping in case the Object holding this pointer has +// already been processed by the GC. static inline void GC::WriteBarrier(DObject *pointing, DObject *pointed) { if (pointed != NULL && pointed->IsWhite() && pointing->IsBlack()) diff --git a/src/serializer.cpp b/src/serializer.cpp index 7861701c01..3a66a8397c 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -1451,7 +1451,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, DObject *&value, DObje { ndx = -1; } - else if (value->ObjectFlags & OF_EuthanizeMe) + else if (value->ObjectFlags & (OF_EuthanizeMe | OF_Transient)) { return arc; }