Access violation when releasing a GlobalSession before other sessions #6344
Labels
goal:quality & productivity
Quality issues and issues that impact our productivity coding day to day inside slang
kind:documentation
areas where we can improve documentation in codebase
Milestone
Setup: slang master on windows x64, vs2022
This example program crashes (adapted from
reflection-api
):Code
Compared to the original example I added
globalSession = nullptr;
to release the reference early. It then crashes in the destructor ofsession
at the end of the function:Call stack
I'm not sure if it's a bug or if there's an implicit requirement of
GlobalSession
living at least as long as the objects returned bycreateSession
. I didn't see any mention of that in the docs so I expected the sessions to hold a strong reference toGlobalSession
.For context I encountered this issue with
slang-rs
(rust bindings to slang). I stored both session & globalsession in the same struct and the globalsession was deleted first due to field destruction order.The text was updated successfully, but these errors were encountered: