setjmp()/longjmp() completely subvert stack unwinding and therefore exception handling as well as RAII (destructors in general).
From 18.7/4 “Other runtime support” in the standard:
If any automatic objects would be destroyed by a thrown exception transferring
control to another (destination) point in the program, then a call tolongjmp(jbuf, val)at the throw point that transfers control to the same (destination) point has undefined behavior.
So the bottom line is that setjmp()/longjmp() do not play well in C++.