]> git.lyx.org Git - lyx.git/commitdiff
Autosaving is now always threaded.
authorPavel Sanda <sanda@lyx.org>
Sun, 4 Nov 2012 15:50:56 +0000 (16:50 +0100)
committerPavel Sanda <sanda@lyx.org>
Sun, 4 Nov 2012 15:51:18 +0000 (16:51 +0100)
src/Buffer.cpp
src/frontends/qt4/GuiView.cpp

index c5de4c8169adf1ac7c429bead18df300f7ed8c5f..313b937940573d75d787e9d65845fe8b4392ecfb 100644 (file)
@@ -3625,26 +3625,19 @@ bool Buffer::autoSave() const
        buf->d->bak_clean = true;
 
        FileName const fname = getAutosaveFileName();
-       if (d->cloned_buffer_) {
-               // If this buffer is cloned, we assume that
-               // we are running in a separate thread already.
-               FileName const tmp_ret = FileName::tempName("lyxauto");
-               if (!tmp_ret.empty()) {
-                       writeFile(tmp_ret);
-                       // assume successful write of tmp_ret
-                       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;
+       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");
+       if (!tmp_ret.empty()) {
+               writeFile(tmp_ret);
+               // assume successful write of tmp_ret
+               if (tmp_ret.moveTo(fname))
+                       return true;
        }
+       // failed to write/rename tmp_ret so try writing direct
+       return writeFile(fname);
 }
 
 
index 0675680734758191de880090234c2c95144893a3..871a2d282d3eca2945d63986c86319249b03a146 100644 (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();
 }