So does your code make sure that no memory block is referenced both in the vector and in the undo system?
I have a feeling that it takes psychic powers to tell what the problem is without any actual code.
I think I may be confusing myself here a bit too.... I found the issue. The fact that I'm undoing the layer delete makes the undo buffer in fact get the deleted on tool exit because I push back the same layer onto the vector... ahhrg.:) The strange thing is it did not complain when the undo destructor was called, only later when trying to use the buffer. I just need to check in the undo class if the layer has been pushed back and if so do not delete the buffer.
So problem solved, thanks a lot for helping out!