[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kinit
From: Waldo Bastian <bastian () kde ! org>
Date: 2005-01-18 17:41:27
Message-ID: 20050118174127.52F841CF80 () office ! kde ! org
[Download RAW message or body]
CVS commit by waba:
Improve handling of starting kdeinit twice in a row.
M +16 -7 klauncher_main.cpp 1.37
--- kdelibs/kinit/klauncher_main.cpp #1.36:1.37
@@ -68,8 +68,8 @@ extern "C" KDE_EXPORT int kdemain( int a
KLocale::setMainCatalogue("kdelibs");
- // Check DCOP communication.
+ int maxTry = 3;
+ while(true)
{
- DCOPClient testDCOP;
- QCString dcopName = testDCOP.registerAs(cname, false);
+ QCString dcopName = KApplication::dcopClient()->registerAs(name, false);
if (dcopName.isEmpty())
{
@@ -77,11 +77,20 @@ extern "C" KDE_EXPORT int kdemain( int a
return 1;
}
- if (dcopName != cname)
+ if (dcopName == cname)
+ break; // Good!
+
+ if (--maxTry == 0)
{
- kdWarning() << "Already running!" << endl;
+ kdWarning() << "Another instance of klauncher is already running!" << endl;
+ return 1;
}
+
+ // Wait a bit...
+ kdWarning() << "Waiting for already running klauncher to exit." << endl;
+ sleep(1);
+
+ // Try again...
}
- KApplication::dcopClient()->registerAs(name, false);
KLauncher *launcher = new KLauncher(LAUNCHER_FD);
launcher->dcopClient()->setDefaultObject( name );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic