aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llappviewerwin32.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llappviewerwin32.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/linden/indra/newview/llappviewerwin32.cpp b/linden/indra/newview/llappviewerwin32.cpp
index 2a6fd60..34e6d42 100644
--- a/linden/indra/newview/llappviewerwin32.cpp
+++ b/linden/indra/newview/llappviewerwin32.cpp
@@ -124,6 +124,27 @@ LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *excepti
124 return retval; 124 return retval;
125} 125}
126 126
127// Create app mutex creates a unique global windows object.
128// If the object can be created it returns true, otherwise
129// it returns false. The false result can be used to determine
130// if another instance of a second life app (this vers. or later)
131// is running.
132// *NOTE: Do not use this method to run a single instance of the app.
133// This is intended to help debug problems with the cross-platform
134// locked file method used for that purpose.
135bool create_app_mutex()
136{
137 bool result = true;
138 LPCWSTR unique_mutex_name = L"SecondLifeAppMutex";
139 HANDLE hMutex;
140 hMutex = CreateMutex(NULL, TRUE, unique_mutex_name);
141 if(GetLastError() == ERROR_ALREADY_EXISTS)
142 {
143 result = false;
144 }
145 return result;
146}
147
127//#define DEBUGGING_SEH_FILTER 1 148//#define DEBUGGING_SEH_FILTER 1
128#if DEBUGGING_SEH_FILTER 149#if DEBUGGING_SEH_FILTER
129# define WINMAIN DebuggingWinMain 150# define WINMAIN DebuggingWinMain
@@ -151,6 +172,10 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
151 172
152 viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash); 173 viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
153 174
175 // Set a debug info flag to indicate if multiple instances are running.
176 bool found_other_instance = !create_app_mutex();
177 gDebugInfo["FoundOtherInstanceAtStartup"] = LLSD::Boolean(found_other_instance);
178
154 bool ok = viewer_app_ptr->init(); 179 bool ok = viewer_app_ptr->init();
155 if(!ok) 180 if(!ok)
156 { 181 {
@@ -204,11 +229,8 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
204 //start updater 229 //start updater
205 if(LLAppViewer::sUpdaterInfo) 230 if(LLAppViewer::sUpdaterInfo)
206 { 231 {
207#if LL_WINDOWS
208 _spawnl(_P_NOWAIT, LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), LLAppViewer::sUpdaterInfo->mParams.str().c_str(), NULL); 232 _spawnl(_P_NOWAIT, LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), LLAppViewer::sUpdaterInfo->mParams.str().c_str(), NULL);
209#elif LL_DARWIN 233
210 system(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str()); /* Flawfinder: ignore */
211#endif
212 delete LLAppViewer::sUpdaterInfo ; 234 delete LLAppViewer::sUpdaterInfo ;
213 LLAppViewer::sUpdaterInfo = NULL ; 235 LLAppViewer::sUpdaterInfo = NULL ;
214 } 236 }