From 77d1fa974ad6cc9be0b84e574b455693bfa7f702 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Fri, 8 Oct 2010 17:37:38 -0700
Subject: [PATCH] added "FastQuit" option for forceful termination, default is
 off

---
 indra/newview/app_settings/settings.xml | 11 +++++++++++
 indra/newview/llappviewer.cpp           | 14 ++++++++++++++
 indra/newview/llappviewer.h             |  1 +
 indra/newview/llappviewerwin32.cpp      |  6 ++++++
 4 files changed, 32 insertions(+)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 142378b5403..bc06078928f 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -2962,6 +2962,17 @@
         <string>Boolean</string>
         <key>Value</key>
         <integer>0</integer>
+    </map>
+    <key>FastQuit</key>
+      <map>
+        <key>Comment</key>
+        <string>Quits as quickly as possible, only sending logout request before forcefully terminating.  Use with care, as this might result in data corruption or loss.</string>
+        <key>Persist</key>
+        <integer>1</integer>
+        <key>Type</key>
+        <string>Boolean</string>
+        <key>Value</key>
+        <integer>0</integer>
     </map>
 	<key>FeatureManagerHTTPTable</key>
       <map>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index e6661e4c9ab..91fae709df9 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2879,8 +2879,22 @@ void LLAppViewer::forceQuit()
 	LLApp::setQuitting(); 
 }
 
+void LLAppViewer::fastQuit()
+{
+	if (LLStartUp::getStartupState() >= STATE_STARTED)
+	{
+		sendLogoutRequest();
+	}
+	_exit(isError());	
+}
+
 void LLAppViewer::requestQuit()
 {
+	if (gSavedSettings.getBOOL("FastQuit"))
+	{
+		fastQuit();
+	}
+
 	llinfos << "requestQuit" << llendl;
 
 	LLViewerRegion* region = gAgent.getRegion();
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index b0f8c1dc3da..62ebd0712ee 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -66,6 +66,7 @@ class LLAppViewer : public LLApp
 
 	// Application control
 	void forceQuit(); // Puts the viewer into 'shutting down without error' mode.
+	void fastQuit(); // Shuts down the viewer immediately after sending a logout message
 	void requestQuit(); // Request a quit. A kinder, gentler quit.
 	void userQuit(); // The users asks to quit. Confirm, then requestQuit()
     void earlyExit(const std::string& name, 
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index d328567a0e0..2c6f014d17c 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -175,6 +175,12 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
 		viewer_app_ptr->mainLoop();
 	}
 
+	if (gSavedSettings.getBOOL("FastQuit"))
+	{
+		viewer_app_ptr->fastQuit();
+	}
+
+
 	if (!LLApp::isError())
 	{
 		//
-- 
GitLab