diff options
author | Jacek Antonelli | 2008-12-12 23:24:52 -0600 |
---|---|---|
committer | Jacek Antonelli | 2008-12-12 23:25:00 -0600 |
commit | d1345838c6e36c35dbe3a6b683eb8ffe274b024a (patch) | |
tree | 5e727fcabbd5cf0337c11192bfe4db6191c7b044 /linden/indra/newview/llappviewerwin32.cpp | |
parent | Second Life viewer sources 1.22.2-RC (diff) | |
download | meta-impy-d1345838c6e36c35dbe3a6b683eb8ffe274b024a.zip meta-impy-d1345838c6e36c35dbe3a6b683eb8ffe274b024a.tar.gz meta-impy-d1345838c6e36c35dbe3a6b683eb8ffe274b024a.tar.bz2 meta-impy-d1345838c6e36c35dbe3a6b683eb8ffe274b024a.tar.xz |
Second Life viewer sources 1.22.3-RC
Diffstat (limited to 'linden/indra/newview/llappviewerwin32.cpp')
-rw-r--r-- | linden/indra/newview/llappviewerwin32.cpp | 30 |
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. | ||
135 | bool 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 | } |