On Wed Aug 2 17:48:59 2023 +0000, Gabriel Ivăncescu wrote:
Or I could simplify it to:
VARIANT tmp = *v; V_VT(v) = VT_EMPTY; VariantClear(&tmp);
I think that it's generally a good strategy to free things that are not participating in CC graph in destructor instead of unlink. It's just safer and we don't have similar considerations there. I'm not sure how much we need to worry about VT_UNKNOWN, but I imagine that we may have something like `traverse_variant` and in that case we'd just have to make sure that those two are consistent. For all corner cases like safe arrays of dispatches (that we're unlikely to care about in traversal), destructor is safe, so a simple `VariantClear` there is enough.
NULL VT_DISPATCH is not really wrong, such variants are used and we need to worry about them already.