Reviewed whole code and made serious effort to reduce to minimum or even completely eliminate memory leaks / corruptions.
Files saving (.spr in particular) now finally works properly! They correctly loaded back to editor afterwards.