Title: Fix access violation exception on shutdown by Frawak · Pull Request #2386 · pythonnet/pythonnet · GitHub
Open Graph Title: Fix access violation exception on shutdown by Frawak · Pull Request #2386 · pythonnet/pythonnet
X Title: Fix access violation exception on shutdown by Frawak · Pull Request #2386 · pythonnet/pythonnet
Description: What does this implement/fix? Explain your changes. When nulling the GC handles on shutdown the reference count of all objects pointed to by the IntPtr in the CLRObject.reflectedObjects are zero. This caused an exception in some scenarios because Runtime.PyObject_TYPE(reflectedClrObject) is called while the reference counter is at zero. After TypeManager.RemoveTypes(); is called in the Runtime.Shutdown() method, reference count decrements to zero do not invoke ClassBase.tp_clear for managed objects anymore which normally is responsible for freeing GC handles and removing references from CLRObject.reflectedObjects. Collecting objects referenced in CLRObject.reflectedObjects only after leads to an unstable state in which the reference count for these object addresses is zero while still maintaining them to be used for further pseudo-cleanup. In that time, the memory could have been reclaimed already which leads to the exception. Does this close any currently open issues? #1977 Any other comments? ... Checklist Check all those that are applicable and complete. Make sure to include one or more tests for your change If an enhancement PR, please create docs and at best an example Ensure you have signed the .NET Foundation CLA Add yourself to AUTHORS Updated the CHANGELOG
Open Graph Description: What does this implement/fix? Explain your changes. When nulling the GC handles on shutdown the reference count of all objects pointed to by the IntPtr in the CLRObject.reflectedObjects are zero. T...
X Description: What does this implement/fix? Explain your changes. When nulling the GC handles on shutdown the reference count of all objects pointed to by the IntPtr in the CLRObject.reflectedObjects are zero. T...
Opengraph URL: https://github.com/pythonnet/pythonnet/pull/2386
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ea1c146d-168f-a4da-963d-04288a8ed76a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CFF2:3891C0:124092D:187C4DF:69702E1B |
| html-safe-nonce | cdbf0c36e101389ae81cd3e9f215459750b5b4b1a0d24f452a56fee1281922f0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkYyOjM4OTFDMDoxMjQwOTJEOjE4N0M0REY6Njk3MDJFMUIiLCJ2aXNpdG9yX2lkIjoiMTk0NTA1NzMwOTkxNzk4MjIzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 69d28d98a56582b5aa5e1b30c997221ff337f0e602c3052c3e7a47146d4cf76d |
| hovercard-subject-tag | pull_request:1866806828 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/pythonnet/pythonnet/pull/2386/files |
| twitter:image | https://avatars.githubusercontent.com/u/31745945?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/31745945?s=400&v=4 |
| og:image:alt | What does this implement/fix? Explain your changes. When nulling the GC handles on shutdown the reference count of all objects pointed to by the IntPtr in the CLRObject.reflectedObjects are zero. T... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01fa379f5de85ef8e791d09724e69709ce9eb9595278316e0a921312dc88e0bc |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dda91974c069382b0dfa47b2da7e28bd061c8331 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width