]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Bug fixed: if 'splash' parameter is not set, then application crashed. Now OK.
authorasv <asv@opencascade.com>
Fri, 24 Jun 2005 12:32:44 +0000 (12:32 +0000)
committerasv <asv@opencascade.com>
Fri, 24 Jun 2005 12:32:44 +0000 (12:32 +0000)
src/Session/SALOME_Session_Server.cxx
src/Session/Session_ServerLauncher.cxx
src/Session/Session_ServerLauncher.hxx

index 368b63c8df0c6bdd714010e1e41cc5cfc84c2399..621aada177d9f4c992efb9cab7e6241193792cb5 100755 (executable)
@@ -256,15 +256,16 @@ int main(int argc, char **argv)
 
     // CORBA Servant Launcher
     QMutex _GUIMutex ;
-    QWaitCondition _ServerLaunch;
+    QWaitCondition _ServerLaunch, _SessionStarted;
     _GUIMutex.lock();     // to block Launch server thread until wait(mutex)
     
     // 2. activate embedded CORBA servers: Registry, SALOMEDS, etc.
     Session_ServerLauncher* myServerLauncher
-      = new Session_ServerLauncher(argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch);
+      = new Session_ServerLauncher(argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch, &_SessionStarted);
     myServerLauncher->start();
     
-    _ServerLaunch.wait(&_GUIMutex); // to be reseased by Launch server thread when ready:
+    _ServerLaunch.wait(&_GUIMutex); // to be reseased by Launch server thread when ready
+
     // show splash screen if "SPLASH" parameter was passed (default)
     if ( isFound( "SPLASH", argc, argv ) ) 
     {
@@ -290,6 +291,8 @@ int main(int argc, char **argv)
       if ( splash.getExitStatus() ) // 1 is error
        exit( splash.getExitStatus() ); // quit applicaiton
     }
+    else
+      _SessionStarted.wait();
 
     // call Session::GetInterface() if "GUI" parameter was passed (default) 
     if ( isFound( "GUI", argc, argv ) ) 
index b361fbf9eb66a53918e546678a0aaf6d6d9dbfc0..b15f682a57e3812e4b5a7248d7d0ccd5bf46e4fd 100755 (executable)
@@ -53,7 +53,8 @@ Session_ServerLauncher::Session_ServerLauncher(int argc,
                                               CORBA::ORB_ptr orb, 
                                               PortableServer::POA_ptr poa,
                                               QMutex *GUIMutex,
-                                              QWaitCondition *ServerLaunch)
+                                              QWaitCondition *ServerLaunch,
+                                              QWaitCondition *SessionStarted)
 {
   _argc = argc;
   _argv = argv;
@@ -61,6 +62,7 @@ Session_ServerLauncher::Session_ServerLauncher(int argc,
   _root_poa = PortableServer::POA::_duplicate(poa);
   _GUIMutex = GUIMutex;
   _ServerLaunch = ServerLaunch;
+  _SessionStarted = SessionStarted;
 }
 
 //=============================================================================
@@ -81,14 +83,15 @@ Session_ServerLauncher::~Session_ServerLauncher()
 
 void Session_ServerLauncher::run()
 {
-  MESSAGE("****>>> Session_ServerLauncher::run");
   _GUIMutex->lock(); // lock released by calling thread when ready: wait(mutex)
-  MESSAGE("****>>> Server Launcher thread free to go...");
-   _GUIMutex->unlock();
-   _ServerLaunch->wakeAll();
+  _GUIMutex->unlock();
+  _ServerLaunch->wakeAll();
+
   CheckArgs();
   ActivateAll();
 
+  _SessionStarted->wakeAll(); // wake main thread
+
   _orb->run();       // this thread wait, during omniORB process events
 }
 
@@ -195,7 +198,7 @@ void Session_ServerLauncher::ActivateAll()
        argv[i+1] = _argv[(*itServ)._firstArg + i];
     }
 
-std::cout << "*** activating [" << argc << "] : " << argv[0] << std::endl;
+    std::cout << "*** activating [" << argc << "] : " << argv[0] << std::endl;
 
     Session_ServerThread* aServerThread
       = new Session_ServerThread(argc, argv, _orb,_root_poa,_GUIMutex);
@@ -205,8 +208,7 @@ std::cout << "*** activating [" << argc << "] : " << argv[0] << std::endl;
   }
 
   // Always launch Session Server
-
-std::cout << "*** activating [ SESSION ] " << std::endl;
+  std::cout << "*** activating [ SESSION ] " << std::endl;
 
   int argc=1;
   char** argv = new char*[argc];
@@ -229,7 +231,7 @@ void Session_ServerLauncher::KillAll()
   MESSAGE("Session_ServerLauncher::KillAll()");
   list<Session_ServerThread*>::reverse_iterator itServ;
   for (itServ = _serverThreads.rbegin(); itServ !=_serverThreads.rend(); itServ++)
-    {
-      delete (*itServ);
-    }
+  {
+    delete (*itServ);
+  }
 }
index 45804e17d20eead3446e771fcd13e7f105fcf6cb..cb3bec809e1523f58e99ff9afb5a03fc9d1d0c50 100755 (executable)
@@ -62,7 +62,8 @@ public:
                         CORBA::ORB_ptr orb, 
                         PortableServer::POA_ptr poa,
                         QMutex *GUIMutex,
-                        QWaitCondition *ServerLaunch);
+                        QWaitCondition *ServerLaunch,
+                        QWaitCondition *SessionStarted);
   virtual ~Session_ServerLauncher();
   void run();
   void KillAll();
@@ -78,6 +79,7 @@ private:
   PortableServer::POA_var _root_poa;
   QMutex* _GUIMutex;
   QWaitCondition *_ServerLaunch;
+  QWaitCondition *_SessionStarted;
   list<ServArg> _argServToLaunch;
   vector<string> _argCopy;
   list<Session_ServerThread*> _serverThreads;