зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1553781: When the remote service finds an instance to remote to it doesn't clean up the startup lock. r=glandium
This fixes the issue in a few redundant ways: * nsProfileLock is made to properly clean itself up when destroyed. * nsRemoteService makes sure the unlock when destroyed. * nsAppRunner unlocks when a remote client has been found. Differential Revision: https://phabricator.services.mozilla.com/D32360 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8a3753f034
Коммит
cf20f54068
|
@ -77,10 +77,10 @@ void nsRemoteService::LockStartup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsRemoteService::UnlockStartup() {
|
void nsRemoteService::UnlockStartup() {
|
||||||
mRemoteLock.Unlock();
|
|
||||||
mRemoteLock.Cleanup();
|
|
||||||
|
|
||||||
if (mRemoteLockDir) {
|
if (mRemoteLockDir) {
|
||||||
|
mRemoteLock.Unlock();
|
||||||
|
mRemoteLock.Cleanup();
|
||||||
|
|
||||||
mRemoteLockDir->Remove(false);
|
mRemoteLockDir->Remove(false);
|
||||||
mRemoteLockDir = nullptr;
|
mRemoteLockDir = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,10 @@ void nsRemoteService::StartupServer() {
|
||||||
|
|
||||||
void nsRemoteService::ShutdownServer() { mRemoteServer = nullptr; }
|
void nsRemoteService::ShutdownServer() { mRemoteServer = nullptr; }
|
||||||
|
|
||||||
nsRemoteService::~nsRemoteService() { ShutdownServer(); }
|
nsRemoteService::~nsRemoteService() {
|
||||||
|
UnlockStartup();
|
||||||
|
ShutdownServer();
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsRemoteService::Observe(nsISupports* aSubject, const char* aTopic,
|
nsRemoteService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||||
|
|
|
@ -84,7 +84,11 @@ nsProfileLock& nsProfileLock::operator=(nsProfileLock& rhs) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsProfileLock::~nsProfileLock() { Unlock(); }
|
nsProfileLock::~nsProfileLock() {
|
||||||
|
Unlock();
|
||||||
|
// Note that we don't clean up by default here so on next startup we know when
|
||||||
|
// the profile was last used based on the modification time of the lock file.
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(XP_UNIX)
|
#if defined(XP_UNIX)
|
||||||
|
|
||||||
|
@ -566,8 +570,14 @@ nsresult nsProfileLock::Unlock(bool aFatalSignal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsProfileLock::Cleanup() {
|
nsresult nsProfileLock::Cleanup() {
|
||||||
|
if (mHaveLock) {
|
||||||
|
return NS_ERROR_FILE_IS_LOCKED;
|
||||||
|
}
|
||||||
|
|
||||||
if (mLockFile) {
|
if (mLockFile) {
|
||||||
return mLockFile->Remove(false);
|
nsresult rv = mLockFile->Remove(false);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
mLockFile = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -4000,9 +4000,11 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
|
||||||
RemoteResult rr = mRemoteService->StartClient(desktopStartupIDPtr);
|
RemoteResult rr = mRemoteService->StartClient(desktopStartupIDPtr);
|
||||||
if (rr == REMOTE_FOUND) {
|
if (rr == REMOTE_FOUND) {
|
||||||
*aExitFlag = true;
|
*aExitFlag = true;
|
||||||
|
mRemoteService->UnlockStartup();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (rr == REMOTE_ARG_BAD) {
|
if (rr == REMOTE_ARG_BAD) {
|
||||||
|
mRemoteService->UnlockStartup();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче