I'm having trouble understanding somethiong. So I have a method that uses a std::for_each with a lambda function. In this lambda function, I do a dynamic_cast. That's just for a little context. This dynamic_cast crashes. I am not asking why it crashes or how to fix it because I know (I did a dynamic_cast on an object that was deleted). My question is why this crashes only in debug mode (in Qt) ?
I understand why it crashes in debug, but I don't understand why it doesn't crash in release. I had a similar problem few weeks ago on a different code, but both time, the crash was a segmentation fault. Is it because a segfault is an undefiened behaviour and this behaviour is different between debug and release ?
Thanks.