Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 958dd30

Browse files
committed
Only release meta type if stashed
1 parent 1c0afe6 commit 958dd30

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/runtime/Runtime.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ internal static void Initialize(bool initSigs = false)
170170
}
171171
else
172172
{
173-
PyCLRMetaType = MetaType.Initialize();
173+
PyCLRMetaType = PyCLRMetaType ?? MetaType.Initialize();
174174
ImportHook.Initialize();
175175
}
176176
Exceptions.Initialize();
@@ -288,9 +288,12 @@ internal static void Shutdown()
288288
TypeManager.RemoveTypes();
289289
_typesInitialized = false;
290290

291-
MetaType.Release();
292-
PyCLRMetaType.Dispose();
293-
PyCLRMetaType = null!;
291+
if (RuntimeData.HasStashData())
292+
{
293+
MetaType.Release();
294+
PyCLRMetaType.Dispose();
295+
PyCLRMetaType = null!;
296+
}
294297

295298
Exceptions.Shutdown();
296299
PythonEngine.InteropConfiguration.Dispose();

0 commit comments

Comments
 (0)