From f7588522668cdf21d4eaf837a07ebbdc998fa6ef Mon Sep 17 00:00:00 2001
From: Aimee Linden <aimee@lindenlab.com>
Date: Sun, 25 Apr 2010 00:41:41 +0100
Subject: [PATCH] DEV-42251 (SNOW-570 / SNOW-220 / VWR-14711): WaitNextEvent()
 is deprecated in the OS X 10.6 SDK

Imported from Snowglobe.
Use RunApplicationEventLoop() instead of WaitNextEvent() while the viewer is waiting for the crash logger to exit.
---
 doc/contributions.txt               |  2 ++
 indra/newview/llappviewermacosx.cpp | 19 +++++++++----------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index 743f64d0b55..4653248d797 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -17,6 +17,7 @@ Agathos Frascati
 	CT-317
 	CT-352
 Aimee Trescothick
+	SNOW-570
 	SNOW-572
 	VWR-3321
 	VWR-3336
@@ -49,6 +50,7 @@ Aimee Trescothick
 	VWR-14087
 	VWR-14267
 	VWR-14278
+	VWR-14711
 	VWR-14712
 Alejandro Rosenthal
 	VWR-1184
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 80d9b143457..7aeeb418f1a 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -291,6 +291,7 @@ static OSStatus CarbonEventHandler(EventHandlerCallRef inHandlerCallRef,
 		if(os_result >= 0 && matching_psn)
 		{
 			sCrashReporterIsRunning = false;
+			QuitApplicationEventLoop();
 		}
     }
     return noErr;
@@ -326,7 +327,7 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze)
 			// *NOTE:Mani A better way - make a copy of the data that the crash reporter will send
 			// and let SL go about its business. This way makes the mac work like windows and linux
 			// and is the smallest patch for the issue. 
-			sCrashReporterIsRunning = true;
+			sCrashReporterIsRunning = false;
 			ProcessSerialNumber o_psn;
 
 			static EventHandlerRef sCarbonEventsRef = NULL;
@@ -356,15 +357,13 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze)
 			
 			if(os_result >= 0)
 			{	
-				EventRecord evt;
-				while(sCrashReporterIsRunning)
-				{
-					while(WaitNextEvent(osMask, &evt, 0, NULL))
-					{
-						// null op!?!
-					}
-				}
-			}	
+				sCrashReporterIsRunning = true;
+			}
+
+			while(sCrashReporterIsRunning)
+			{
+				RunApplicationEventLoop();
+			}
 
 			// Re-install the apps quit handler.
 			AEInstallEventHandler(kCoreEventClass, 
-- 
GitLab