Chromium Code Reviews| Index: chrome/browser/process_singleton_win.cc |
| =================================================================== |
| --- chrome/browser/process_singleton_win.cc (revision 141718) |
| +++ chrome/browser/process_singleton_win.cc (working copy) |
| @@ -199,7 +199,15 @@ |
| } |
| ProcessSingleton::~ProcessSingleton() { |
| - Cleanup(); |
| + // We need to unregister the window as late as possible so that we can detect |
| + // another instance of chrome running. Otherwise we may end up writing out |
| + // data while a new chrome is starting up. |
| + if (window_) { |
| + ::DestroyWindow(window_); |
| + ::UnregisterClass(chrome::kMessageWindowClass, |
| + base::GetModuleFromAddress(&ThunkWndProc)); |
| + window_ = NULL; |
|
jam
2012/06/15 21:56:22
nit: this was never needed before, so feel free to
|
| + } |
| } |
| ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { |
| @@ -302,18 +310,6 @@ |
| } |
| void ProcessSingleton::Cleanup() { |
| - // Window classes registered by DLLs are not cleaned up automatically on |
| - // process exit, so we must unregister at the earliest chance possible. |
| - // During the fast shutdown sequence, ProcessSingleton::Cleanup() is |
| - // called if our process was the first to start. Therefore we try cleaning |
| - // up here, and again in the destructor if needed to catch as many cases |
| - // as possible. |
| - if (window_) { |
| - ::DestroyWindow(window_); |
| - ::UnregisterClass(chrome::kMessageWindowClass, |
| - base::GetModuleFromAddress(&ThunkWndProc)); |
| - window_ = NULL; |
| - } |
| } |
| LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) { |