Autosaving is now always threaded.

This commit is contained in:
Pavel Sanda 2012-11-04 16:50:56 +01:00
parent 3f4b4d7676
commit d7ed0ba7e4
2 changed files with 12 additions and 23 deletions

View File

@ -3625,7 +3625,8 @@ bool Buffer::autoSave() const
buf->d->bak_clean = true;
FileName const fname = getAutosaveFileName();
if (d->cloned_buffer_) {
LASSERT(d->cloned_buffer_, return false);
// If this buffer is cloned, we assume that
// we are running in a separate thread already.
FileName const tmp_ret = FileName::tempName("lyxauto");
@ -3637,14 +3638,6 @@ bool Buffer::autoSave() const
}
// failed to write/rename tmp_ret so try writing direct
return writeFile(fname);
} else {
/// This function is deprecated as the frontend needs to take care
/// of cloning the buffer and autosaving it in another thread. It
/// is still here to allow (QT_VERSION < 0x040400).
AutoSaveBuffer autosave(*this, fname);
autosave.start();
return true;
}
}

View File

@ -1545,14 +1545,10 @@ void GuiView::autoSave()
return;
}
#if (QT_VERSION >= 0x040400)
GuiViewPrivate::busyBuffers.insert(buffer);
QFuture<docstring> f = QtConcurrent::run(GuiViewPrivate::autosaveAndDestroy,
buffer, buffer->cloneBufferOnly());
d.autosave_watcher_.setFuture(f);
#else
buffer->autoSave();
#endif
resetAutosaveTimers();
}