Ashesh, Akshay,

Can one of you please review/commit the attached patch? The RM is
https://redmine.postgresql.org/issues/1909

Thanks!

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/runtime/pgAdmin4.cpp b/runtime/pgAdmin4.cpp
index 8cae3f7..9ce1958 100644
--- a/runtime/pgAdmin4.cpp
+++ b/runtime/pgAdmin4.cpp
@@ -71,56 +71,72 @@ int main(int argc, char * argv[])
     }
 
     // Fire up the webserver
-    Server *server = new Server(port);
+    Server *server;
 
-    if (!server->Init())
+    bool done = false;
+
+    while (done != true)
     {
-        qDebug() << server->getError();
+        server = new Server(port);
 
-        QString error = QString(QWidget::tr("An error occurred initialising 
the application server:\n\n%1")).arg(server->getError());
-        QMessageBox::critical(NULL, QString(QWidget::tr("Fatal Error")), 
error);
-       
-        exit(1);
-    }
+        if (!server->Init())
+        {
+            qDebug() << server->getError();
 
-    server->start();
+            QString error = QString(QWidget::tr("An error occurred 
initialising the application server:\n\n%1")).arg(server->getError());
+            QMessageBox::critical(NULL, QString(QWidget::tr("Fatal Error")), 
error);
 
-    // This is a hack. Wait a second and then check to see if the server thread
-    // is still running. If it's not, we probably had a startup error
-    delay(1000);
+            exit(1);
+        }
 
-    // Any errors?
-    if (server->isFinished() || server->getError().length() > 0)
-    {
-        qDebug() << server->getError();
+        server->start();
 
-        QString error = QString(QWidget::tr("An error occurred initialising 
the application server:\n\n%1")).arg(server->getError());
-        QMessageBox::critical(NULL, QString(QWidget::tr("Fatal Error")), 
error);
+        // This is a hack. Wait a second and then check to see if the server 
thread
+        // is still running. If it's not, we probably had a startup error
+        delay(1000);
 
-        // Allow the user to tweak the Python Path if needed
-        QSettings settings;
-        bool ok;
+        // Any errors?
+        if (server->isFinished() || server->getError().length() > 0)
+        {
+            splash->finish(NULL);
 
-        ConfigWindow *dlg = new ConfigWindow();
-        dlg->setWindowTitle(QWidget::tr("Configuration"));
-        dlg->setPythonPath(settings.value("PythonPath").toString());
-        dlg->setApplicationPath(settings.value("ApplicationPath").toString());
-        dlg->setModal(true);
-        ok = dlg->exec();
+            qDebug() << server->getError();
 
-        QString pythonpath = dlg->getPythonPath();
-        QString applicationpath = dlg->getApplicationPath();
+            QString error = QString(QWidget::tr("An error occurred 
initialising the application server:\n\n%1")).arg(server->getError());
+            QMessageBox::critical(NULL, QString(QWidget::tr("Fatal Error")), 
error);
 
-        if (ok)
-        {
-            settings.setValue("PythonPath", pythonpath);
-            settings.setValue("ApplicationPath", applicationpath);
-            settings.sync();
+            // Allow the user to tweak the Python Path if needed
+            QSettings settings;
+            bool ok;
+
+            ConfigWindow *dlg = new ConfigWindow();
+            dlg->setWindowTitle(QWidget::tr("Configuration"));
+            dlg->setPythonPath(settings.value("PythonPath").toString());
+            
dlg->setApplicationPath(settings.value("ApplicationPath").toString());
+            dlg->setModal(true);
+            ok = dlg->exec();
+
+            QString pythonpath = dlg->getPythonPath();
+            QString applicationpath = dlg->getApplicationPath();
+
+            if (ok)
+            {
+                settings.setValue("PythonPath", pythonpath);
+                settings.setValue("ApplicationPath", applicationpath);
+                settings.sync();
+            }
+            else
+            {
+                exit(1);
+            }
+
+            delete server;
         }
-
-        exit(1);
+        else
+            done = true;
     }
 
+
     // Generate the app server URL
     QString appServerUrl = QString("http://localhost:%1/";).arg(port);
 
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to