diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index bed63c4dbceffc284a08fd9fbd1fdb070e2ebfc6..b14853777d7ffb4226c2eaba7508937a4f349f36 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -188,7 +188,7 @@
 // define a self-registering event API object
 #include "llappviewerlistener.h"
 
-static LLAppViewerListener sAppViewerListener("LLAppViewer", LLAppViewer::instance());
+static LLAppViewerListener sAppViewerListener("LLAppViewer", NULL);
 
 ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor
 //
diff --git a/indra/newview/llappviewerlistener.cpp b/indra/newview/llappviewerlistener.cpp
index a8c98b17a7326b1a6bd84de5e84d926e696a5f75..a3af251a3c33256c5062cc229c50a2f0bda8837b 100644
--- a/indra/newview/llappviewerlistener.cpp
+++ b/indra/newview/llappviewerlistener.cpp
@@ -27,7 +27,11 @@ LLAppViewerListener::LLAppViewerListener(const std::string& pumpname, LLAppViewe
     add("requestQuit", &LLAppViewerListener::requestQuit);
 }
 
-void LLAppViewerListener::requestQuit(const LLSD& event) const
+void LLAppViewerListener::requestQuit(const LLSD& event)
 {
+    if(mAppViewer == NULL)
+    {
+        mAppViewer = LLAppViewer::instance();
+    }
     mAppViewer->requestQuit();
 }
diff --git a/indra/newview/llappviewerlistener.h b/indra/newview/llappviewerlistener.h
index ab17dd1d9042d0dc6a7b1847b5a5c60098080b0c..d702f605ef0e12d27fe8c9b7d6a4b981e6359075 100644
--- a/indra/newview/llappviewerlistener.h
+++ b/indra/newview/llappviewerlistener.h
@@ -26,7 +26,7 @@ class LLAppViewerListener: public LLDispatchListener
     LLAppViewerListener(const std::string& pumpname, LLAppViewer* llappviewer);
 
 private:
-    void requestQuit(const LLSD& event) const;
+    void requestQuit(const LLSD& event);
 
     LLAppViewer* mAppViewer;
 };