I have some code that is crashing in a large system. However, the code essentially boils down to the following pseudo-code. I\'ve removed much of the detail, as I have tried
Thank you for all the answers and comments. All have been useful and relevant.
Any further information is still welcome.
The following was a comment on my question from Hans Passant:
Once you start exporting classes from DLLs, compiling with /MD becomes very important. Looks like /MT to me.
As a result of that, I took a closer look at the linkage setting throughout the project. I found a 'buried' instance of /MT and /MTd that should have been /MD and /MDd, plus some related inconsistencies in other settings.
Having corrected those, no assertion is now thrown, and the code appears to be behaving correctly.
Here are some of the things to check when experiencing crashes or assertion failures at execution leaves scopes and destructors are called. Ensure that throughout all projects (including dependencies) and in all configurations (especially in the problematic one):
(Here the *.vcproj paths are relative to .)
Interestingly, the scalar 'flavour' of delete I'd expect still does not appear to be being called (the breakpoint is never hit). That is, I still only see the vector deleting destructor. Therefore, that may have been a 'red herring'.
Perhaps this is just a Microsoft implementation issue, or perhaps there's still some other subtlety I've missed.