| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -192,6 +192,7 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true, | |||
| 192 | 192 | ||
| 193 | 193 | // Make sure we clean up properly on app domain unload. | |
| 194 | 194 | AppDomain.CurrentDomain.DomainUnload += OnDomainUnload; | |
| 195 | + AppDomain.CurrentDomain.ProcessExit += OnProcessExit; | ||
| 195 | 196 | ||
| 196 | 197 | // The global scope gets used implicitly quite early on, remember | |
| 197 | 198 | // to clear it out when we shut down. | |
@@ -249,6 +250,11 @@ static void OnDomainUnload(object _, EventArgs __) | |||
| 249 | 250 | Shutdown(); | |
| 250 | 251 | } | |
| 251 | 252 | ||
| 253 | + static void OnProcessExit(object _, EventArgs __) | ||
| 254 | + { | ||
| 255 | + Shutdown(); | ||
| 256 | + } | ||
| 257 | + | ||
| 252 | 258 | /// <summary> | |
| 253 | 259 | /// A helper to perform initialization from the context of an active | |
| 254 | 260 | /// CPython interpreter process - this bootstraps the managed runtime | |
@@ -319,6 +325,7 @@ public static void Shutdown(ShutdownMode mode) | |||
| 319 | 325 | // If the shutdown handlers trigger a domain unload, | |
| 320 | 326 | // don't call shutdown again. | |
| 321 | 327 | AppDomain.CurrentDomain.DomainUnload -= OnDomainUnload; | |
| 328 | + AppDomain.CurrentDomain.ProcessExit -= OnProcessExit; | ||
| 322 | 329 | ||
| 323 | 330 | PyScopeManager.Global.Clear(); | |
| 324 | 331 | ExecuteShutdownHandlers(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -393,6 +393,10 @@ internal static void Shutdown(ShutdownMode mode) | |||
| 393 | 393 | { | |
| 394 | 394 | Py_Finalize(); | |
| 395 | 395 | } | |
| 396 | + else | ||
| 397 | + { | ||
| 398 | + PyGILState_Release(state); | ||
| 399 | + } | ||
| 396 | 400 | } | |
| 397 | 401 | } | |
| 398 | 402 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments