No, it is not that simple. Each layer contains its own pointer and memory buffer. The layers in the vector gets freed on exit but the one sent to the undo system is not in the vector then so freeing things in the vector doesn't cause any issues the first time around. The second time the vector is filled in the undo pointer starts pointing to the same memory as the vector layer though for some reason so yes they share memory in some way.



LinkBack URL
About LinkBacks




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.