https://github.com/stellaraccident approved this pull request. LGTM as a patch on the issue. I think we need to add some form of weak references on the C++ side to make this more robust. https://github.com/llvm/llvm-project/pull/93339