Skip to content

Commit 6cdd6d7

Browse files
committed
Move reflected object creation block
Otherwise if you have a Python object that needs to temporarily create a .NET object in its destructor (for instance write log summary to a file), its destructor will fail if it happens to be freed on the second iteration of loop breaking.
1 parent c99cdf3 commit 6cdd6d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/Runtime.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ internal static void Shutdown()
281281

282282
TryCollectingGarbage(MaxCollectRetriesOnShutdown, forceBreakLoops: true,
283283
obj: true, derived: false, buffer: false);
284+
CLRObject.creationBlocked = true;
284285

285286
NullGCHandles(ExtensionType.loadedExtensions);
286287
ClassManager.RemoveClasses();
@@ -357,7 +358,6 @@ static bool TryCollectingGarbage(int runs, bool forceBreakLoops,
357358
{
358359
NullGCHandles(CLRObject.reflectedObjects);
359360
CLRObject.reflectedObjects.Clear();
360-
CLRObject.creationBlocked = true;
361361
}
362362
}
363363
return false;

0 commit comments

Comments
 (0)