diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 195cf84a6541..3599e3195fc5 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -401,6 +401,13 @@ bool App::MakeSingleInstance( } } +void App::ReleaseSingleInstance() { + if (process_singleton_.get()) { + process_singleton_->Cleanup(); + process_singleton_.reset(); + } +} + #if defined(USE_NSS_CERTS) void App::ImportCertificate( const base::DictionaryValue& options, @@ -480,7 +487,8 @@ void App::BuildPrototype( #if defined(USE_NSS_CERTS) .SetMethod("importCertificate", &App::ImportCertificate) #endif - .SetMethod("makeSingleInstance", &App::MakeSingleInstance); + .SetMethod("makeSingleInstance", &App::MakeSingleInstance) + .SetMethod("releaseSingleInstance", &App::ReleaseSingleInstance); } } // namespace api diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index 41aef0ac39e7..979f61f0d219 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -108,6 +108,7 @@ class App : public AtomBrowserClient::Delegate, void SetDesktopName(const std::string& desktop_name); bool MakeSingleInstance( const ProcessSingleton::NotificationCallback& callback); + void ReleaseSingleInstance(); std::string GetLocale(); #if defined(USE_NSS_CERTS) diff --git a/docs/api/app.md b/docs/api/app.md index ba0accf19825..265f328eb9de 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -496,6 +496,11 @@ app.on('ready', () => { }); ``` +### `app.releaseSingleInstance()` + +Releases all locks that were created by `makeSingleInstance`. This will allow +multiple instances of the application to once again run side by side. + ### `app.setUserActivity(type, userInfo[, webpageURL])` _OS X_ * `type` String - Uniquely identifies the activity. Maps to