Issue was cause dby ima->ibufs being stored in a ma on undo/redo and ima->rr not. In case of multilayer image ibufs hares pointer with render result, so current undo/redo policy lead to a dead pointer stored in ibuf. Made it so ima->rr also stores in the map and restores on redo/undo keeping all the pointers fine.