Fixed crash in finalizer of CLR types defined in Python, that survive engine shutdown by lostmsu · Pull Request #1260 · pythonnet/pythonnet

@lostmsu

… engine shutdown

pythonnet#1256
pythonnet#1256

During engine shutdown all links from Python to .NET instances are severed. If an instance of CLR class defined in Python survives the shutdown (for example, a reference is stored in static field) and later gets finalized, it will attempt to severe link again, which is an invalid operation.

The fix is to check if the link has already been severed and skip that step during finalization.

BadSingleton pushed a commit to Unity-Technologies/pythonnet that referenced this pull request

Dec 18, 2020
… engine shutdown (pythonnet#1260)

pythonnet#1256
pythonnet#1256

During engine shutdown all links from Python to .NET instances are severed. If an instance of CLR class defined in Python survives the shutdown (for example, a reference is stored in static field) and later gets finalized, it will attempt to severe link again, which is an invalid operation.

The fix is to check if the link has already been severed and skip that step during finalization.

BadSingleton pushed a commit to Unity-Technologies/pythonnet that referenced this pull request

Dec 18, 2020
… engine shutdown (pythonnet#1260)

pythonnet#1256
pythonnet#1256

During engine shutdown all links from Python to .NET instances are severed. If an instance of CLR class defined in Python survives the shutdown (for example, a reference is stored in static field) and later gets finalized, it will attempt to severe link again, which is an invalid operation.

The fix is to check if the link has already been severed and skip that step during finalization.