Merge remote-tracking branch 'origin/master' into 1.7
This commit is contained in:
@@ -903,11 +903,25 @@ namespace FlaxEngine.Interop
|
||||
|
||||
AssemblyLocations.Remove(assembly.FullName);
|
||||
|
||||
// Clear all caches which might hold references to closing assembly
|
||||
// Unload native library handles associated for this assembly
|
||||
string nativeLibraryName = assemblyOwnedNativeLibraries.GetValueOrDefault(assembly);
|
||||
if (nativeLibraryName != null && loadedNativeLibraries.TryGetValue(nativeLibraryName, out IntPtr nativeLibrary))
|
||||
{
|
||||
NativeLibrary.Free(nativeLibrary);
|
||||
loadedNativeLibraries.Remove(nativeLibraryName);
|
||||
}
|
||||
if (nativeLibraryName != null)
|
||||
nativeLibraryPaths.Remove(nativeLibraryName);
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly]
|
||||
internal static void ReloadScriptingAssemblyLoadContext()
|
||||
{
|
||||
#if FLAX_EDITOR
|
||||
// Clear all caches which might hold references to assemblies in collectible ALC
|
||||
typeCache.Clear();
|
||||
|
||||
// Release all references in collectible ALC
|
||||
#if FLAX_EDITOR
|
||||
cachedDelegatesCollectible.Clear();
|
||||
foreach (var pair in typeHandleCacheCollectible)
|
||||
pair.Value.Free();
|
||||
@@ -918,23 +932,13 @@ namespace FlaxEngine.Interop
|
||||
foreach (var handle in fieldHandleCacheCollectible)
|
||||
handle.Free();
|
||||
fieldHandleCacheCollectible.Clear();
|
||||
#endif
|
||||
|
||||
_typeSizeCache.Clear();
|
||||
|
||||
foreach (var pair in classAttributesCacheCollectible)
|
||||
pair.Value.Free();
|
||||
classAttributesCacheCollectible.Clear();
|
||||
|
||||
// Unload native library handles associated for this assembly
|
||||
string nativeLibraryName = assemblyOwnedNativeLibraries.GetValueOrDefault(assembly);
|
||||
if (nativeLibraryName != null && loadedNativeLibraries.TryGetValue(nativeLibraryName, out IntPtr nativeLibrary))
|
||||
{
|
||||
NativeLibrary.Free(nativeLibrary);
|
||||
loadedNativeLibraries.Remove(nativeLibraryName);
|
||||
}
|
||||
if (nativeLibraryName != null)
|
||||
nativeLibraryPaths.Remove(nativeLibraryName);
|
||||
|
||||
// Unload the ALC
|
||||
bool unloading = true;
|
||||
scriptingAssemblyLoadContext.Unloading += (alc) => { unloading = false; };
|
||||
@@ -945,6 +949,7 @@ namespace FlaxEngine.Interop
|
||||
|
||||
InitScriptingAssemblyLoadContext();
|
||||
DelegateHelpers.InitMethods();
|
||||
#endif
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly]
|
||||
|
||||
Reference in New Issue
Block a user