--- libgig/trunk/src/RIFF.cpp 2005/11/22 09:11:17 808 +++ libgig/trunk/src/RIFF.cpp 2006/02/05 17:30:13 833 @@ -1192,6 +1192,11 @@ } } + void List::LoadSubChunksRecursively() { + for (List* pList = GetFirstSubList(); pList; pList = GetNextSubList()) + pList->LoadSubChunksRecursively(); + } + /** @brief Write list chunk persistently e.g. to disk. * * Stores the list chunk persistently to its actual "physical" file. All @@ -1383,6 +1388,9 @@ * chunk or any kind of IO error occured */ void File::Save() { + // make sure the RIFF tree is built (from the original file) + LoadSubChunksRecursively(); + // reopen file in write mode SetMode(stream_mode_read_write); @@ -1460,6 +1468,9 @@ void File::Save(const String& path) { //TODO: we should make a check here if somebody tries to write to the same file and automatically call the other Save() method in that case + // make sure the RIFF tree is built (from the original file) + LoadSubChunksRecursively(); + if (Filename.length() > 0) SetMode(stream_mode_read); // open the other (new) file for writing and truncate it to zero size #if POSIX