[LyX/master] Remove code that has not been used since 2010.

Richard Kimberly Heck rikiheck at lyx.org
Fri Feb 28 05:01:31 UTC 2020


commit 0dc9fca86ec52d0d05d79683b588a919a2dfad48
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Fri Feb 28 00:21:48 2020 -0500

    Remove code that has not been used since 2010.
    
    See 208acbc72.
---
 src/Buffer.cpp |   85 --------------------------------------------------------
 1 files changed, 0 insertions(+), 85 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 9b6727f..a300b2d 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -4235,91 +4235,6 @@ void Buffer::setGuiDelegate(frontend::GuiBufferDelegate * gui)
 }
 
 
-
-namespace {
-
-class AutoSaveBuffer : public ForkedProcess {
-public:
-	///
-	AutoSaveBuffer(Buffer const & buffer, FileName const & fname)
-		: buffer_(buffer), fname_(fname) {}
-	///
-	virtual shared_ptr<ForkedProcess> clone() const
-	{
-		return make_shared<AutoSaveBuffer>(*this);
-	}
-	///
-	int start()
-	{
-		command_ = to_utf8(bformat(_("Auto-saving %1$s"),
-						 from_utf8(fname_.absFileName())));
-		return run(DontWait);
-	}
-private:
-	///
-	virtual int generateChild();
-	///
-	Buffer const & buffer_;
-	FileName fname_;
-};
-
-
-int AutoSaveBuffer::generateChild()
-{
-#if defined(__APPLE__)
-	/* FIXME fork() is not usable for autosave on Mac OS X 10.6 (snow leopard)
-	 *   We should use something else like threads.
-	 *
-	 * Since I do not know how to determine at run time what is the OS X
-	 * version, I just disable forking altogether for now (JMarc)
-	 */
-	pid_t const pid = -1;
-#else
-	// tmp_ret will be located (usually) in /tmp
-	// will that be a problem?
-	// Note that this calls ForkedCalls::fork(), so it's
-	// ok cross-platform.
-	pid_t const pid = fork();
-	// If you want to debug the autosave
-	// you should set pid to -1, and comment out the fork.
-	if (pid != 0 && pid != -1)
-		return pid;
-#endif
-
-	// pid = -1 signifies that lyx was unable
-	// to fork. But we will do the save
-	// anyway.
-	bool failed = false;
-	TempFile tempfile("lyxautoXXXXXX.lyx");
-	tempfile.setAutoRemove(false);
-	FileName const tmp_ret = tempfile.name();
-	if (!tmp_ret.empty()) {
-		if (!buffer_.writeFile(tmp_ret))
-			failed = true;
-		else if (!tmp_ret.moveTo(fname_))
-			failed = true;
-	} else
-		failed = true;
-
-	if (failed) {
-		// failed to write/rename tmp_ret so try writing direct
-		if (!buffer_.writeFile(fname_)) {
-			// It is dangerous to do this in the child,
-			// but safe in the parent, so...
-			if (pid == -1) // emit message signal.
-				buffer_.message(_("Autosave failed!"));
-		}
-	}
-
-	if (pid == 0) // we are the child so...
-		_exit(0);
-
-	return pid;
-}
-
-} // namespace
-
-
 FileName Buffer::getEmergencyFileName() const
 {
 	return FileName(d->filename.absFileName() + ".emergency");


More information about the lyx-cvs mailing list