mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 02:28:19 +00:00
Autosaving is now always threaded.
This commit is contained in:
parent
3f4b4d7676
commit
d7ed0ba7e4
@ -3625,26 +3625,19 @@ bool Buffer::autoSave() const
|
|||||||
buf->d->bak_clean = true;
|
buf->d->bak_clean = true;
|
||||||
|
|
||||||
FileName const fname = getAutosaveFileName();
|
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.
|
// If this buffer is cloned, we assume that
|
||||||
FileName const tmp_ret = FileName::tempName("lyxauto");
|
// we are running in a separate thread already.
|
||||||
if (!tmp_ret.empty()) {
|
FileName const tmp_ret = FileName::tempName("lyxauto");
|
||||||
writeFile(tmp_ret);
|
if (!tmp_ret.empty()) {
|
||||||
// assume successful write of tmp_ret
|
writeFile(tmp_ret);
|
||||||
if (tmp_ret.moveTo(fname))
|
// assume successful write of tmp_ret
|
||||||
return true;
|
if (tmp_ret.moveTo(fname))
|
||||||
}
|
return true;
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
// failed to write/rename tmp_ret so try writing direct
|
||||||
|
return writeFile(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1545,14 +1545,10 @@ void GuiView::autoSave()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION >= 0x040400)
|
|
||||||
GuiViewPrivate::busyBuffers.insert(buffer);
|
GuiViewPrivate::busyBuffers.insert(buffer);
|
||||||
QFuture<docstring> f = QtConcurrent::run(GuiViewPrivate::autosaveAndDestroy,
|
QFuture<docstring> f = QtConcurrent::run(GuiViewPrivate::autosaveAndDestroy,
|
||||||
buffer, buffer->cloneBufferOnly());
|
buffer, buffer->cloneBufferOnly());
|
||||||
d.autosave_watcher_.setFuture(f);
|
d.autosave_watcher_.setFuture(f);
|
||||||
#else
|
|
||||||
buffer->autoSave();
|
|
||||||
#endif
|
|
||||||
resetAutosaveTimers();
|
resetAutosaveTimers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user