Sfoglia il codice sorgente

Properly clean up temporary data after deserialization

Marko Pintera 11 anni fa
parent
commit
7ed8cf65ee

+ 1 - 0
SBansheeEngine/Include/BsManagedComponentRTTI.h

@@ -79,6 +79,7 @@ namespace BansheeEngine
 			MonoObject* managedInstance = serializableObject->getManagedInstance();
 
 			mc->initialize(managedInstance, runtimeType, managedClass);
+			mc->mRTTIData = nullptr;
 		}
 
 		virtual const String& getRTTIName()

+ 1 - 0
SBansheeEngine/Include/BsManagedResourceRTTI.h

@@ -44,6 +44,7 @@ namespace BansheeEngine
 			ResourcePtr mrPtr = std::static_pointer_cast<Resource>(mr->getThisPtr());
 			HManagedResource handle = static_resource_cast<ManagedResource>(gResources()._createResourceHandle(mrPtr));
 			mr->construct(serializableObject->getManagedInstance(), handle);
+			mr->mRTTIData = nullptr;
 		}
 
 		virtual const String& getRTTIName()

+ 5 - 3
TODO.txt

@@ -2,12 +2,14 @@
 
 See GDrive/Resources doc for resources refactor
 
+There seems to be some kind of memory corruption that happens when cloning game objects. During one clone the field entries provided to
+ManagedSerializeArray::deserializeManagedInstance were reported as ManagedSerializedArray instead of ManagerSerializedFieldData types.
+It's inconsistent to reproduce but started happening after I have modified managed object serialization to be on-demand. It's possibly
+related to lambdas not capturing types as I expect them to.
+
 TODO - Material waits to Shader to be loaded but doesn't wait for shader GpuPrograms. 
  - What's the best way to ensure initialization is done when all these are loaded?
 
-Make RenderTexture accept a HTexture
- - Fix up RenderTextureCore so it doesn't hold a resource handle and instead holds TextureCore ptr (same goes for MultiRenderTexture)
-
 When resource loading starts synchonously read all dependencies (and recurse over their dependencies too)
  - Create a ResourceLoadGroup that contains all the non-loaded resources
  - Cue async loads for all resources