| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -314,7 +314,7 @@ internal static void Shutdown(ShutdownMode mode) | |||
| 314 | 314 | ||
| 315 | 315 | NullGCHandles(ExtensionType.loadedExtensions); | |
| 316 | 316 | ClassManager.RemoveClasses(); | |
| 317 | - TypeManager.RemoveTypes(); | ||
| 317 | + TypeManager.RemoveTypes(mode); | ||
| 318 | 318 | ||
| 319 | 319 | MetaType.Release(); | |
| 320 | 320 | PyCLRMetaType.Dispose(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,20 +45,20 @@ internal static void Initialize() | |||
| 45 | 45 | pythonBaseTypeProvider = PythonEngine.InteropConfiguration.pythonBaseTypeProviders; | |
| 46 | 46 | } | |
| 47 | 47 | ||
| 48 | - internal static void RemoveTypes() | ||
| 48 | + internal static void RemoveTypes(ShutdownMode shutdownMode) | ||
| 49 | 49 | { | |
| 50 | 50 | foreach (var type in cache.Values) | |
| 51 | 51 | { | |
| 52 | - //SlotsHolder holder; | ||
| 53 | - //if (_slotsHolders.TryGetValue(type, out holder)) | ||
| 54 | - //{ | ||
| 55 | - // // If refcount > 1, it needs to reset the managed slot, | ||
| 56 | - // // otherwise it can dealloc without any trick. | ||
| 57 | - // if (Runtime.Refcount(type) > 1) | ||
| 58 | - // { | ||
| 59 | - // holder.ResetSlots(); | ||
| 60 | - // } | ||
| 61 | - //} | ||
| 52 | + if (shutdownMode == ShutdownMode.Extension | ||
| 53 | + && _slotsHolders.TryGetValue(type, out var holder)) | ||
| 54 | + { | ||
| 55 | + // If refcount > 1, it needs to reset the managed slot, | ||
| 56 | + // otherwise it can dealloc without any trick. | ||
| 57 | + if (Runtime.Refcount(type) > 1) | ||
| 58 | + { | ||
| 59 | + holder.ResetSlots(); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | 62 | type.Dispose(); | |
| 63 | 63 | } | |
| 64 | 64 | cache.Clear(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments