From e6561a0122dbf165d51fb974f3751e482b419561 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 25 Dec 2010 17:49:04 +0000 Subject: [PATCH] Fix a race condition on startup that might lead to two instances of Clementine being started. --- src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 73a68c743..3701bb29c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -217,7 +217,11 @@ int main(int argc, char *argv[]) { #endif a.setQuitOnLastWindowClosed(false); - a.isRunning(); // Otherwise QtLocalPeer won't lock the lockfile :S + + // Do this check again because another instance might have started by now + if (a.isRunning() && a.sendMessage(options.Serialize(), 5000)) { + return 0; + } #ifndef Q_OS_DARWIN // Gnome on Ubuntu has menu icons disabled by default. I think that's a bad