... Problem was that before abandoning the connection to the original path,
compaction was done only sometimes, according to the criterion of estimated
%20 space savings at least. But this could cause the project to reopen with
orphan blocks in it, which were detected and reported as an improper save.
The easy solution is to force compaction always in this case.
Direct save does not have this problem because what would otherwise be orphaned
blocks are directly deleted from the database when undo states are destroyed
and sample blocks become unreferenced. So compacting only sometimes does not
cause orphan blocks on reopening.
Uncompacted projects use up 50% or so more space than they could.
The 'compact' feature as currently implemented is confusing, and does
not merit inclusion given the lowish saving. So featured disabled/removed.
... and probably less contention with the checkpoint thread during recording,
and probably less total drop-out time when stress-testing recording with high
sample rates or slow external devices or both.
And another transaction scope for the post-processing of dropouts may reduce the
total time spent there.
... The post-processing of an excessive number of small, touching intervals
was one cause of apparent hangs when stopping recording to a slow external
device and using a high recording sample rate, in my own trials.
... The error that the checkpoint thread got was only SQLITE_BUSY, while the
main thread was simultaneously doing reads only for redrawing the screen.
Do some retrials in case of SQLITE_BUSY.
... This stops a crash that might occur when the checkpoint thread causes
ProjectAudioManager::Stop() to execute but the project is in the process of
closing.
... but not always as much, as before the part of the fix for Bug2579, which is
at 7edbad3cd131b115ead713482308508da8f172bc
The last saved undo state and the current state must (both) be saved (if
different).
... Intermittent crash, depending on some accidents of memory page allocations,
known to happen sometimes when playing a 44100 Hz track at 32000 Hz; the
strange story is in the code comments