]> vaikene.ee Git - evaf/blobdiff - src/main/GUI/main.cpp
Mac OS changes and switched to c++11.
[evaf] / src / main / GUI / main.cpp
index 313d21073e7996df216b055bbc57ea5a6072babc..cffe9ba4f250df7e993991a63e9a042211dec1ae 100644 (file)
@@ -127,20 +127,18 @@ static void messageOutput(QtMsgType type, QMessageLogContext const &, QString co
  */
 static void fatalMsgHandler(QString const & msg, QString const & source, QString const & where)
 {
+    Q_UNUSED(source);
+
     // Show the message on the screen
     if (BeVerbose) {
         if (FatalErr::message(QObject::tr("Fatal Error"),
                               QObject::tr("%1\n\nOccurred in '%2'")
                                             .arg(msg)
                                             .arg(where),
-                              0) == FatalErr::Ignore)
+                              nullptr) == FatalErr::Ignore)
             return;
     }
-#ifdef Q_OS_LINUX
-    abort();
-#else
     exit(1);
-#endif
 }
 
 } // namespace eVaf::GUI::Internal
@@ -389,34 +387,39 @@ int main(int argc, char ** argv)
     if (!Internal::installExitHandler())
         return 1;
 
-    // Plugin manager
-    Plugins::PluginManager pluginManager;
+    int rval = 0;
+    {
+        // Plugin manager
+        Plugins::PluginManager pluginManager;
 
-    // The main run loop
-    bool quit = false;
-    int rval;
-    while (!quit) {
+        // The main run loop
+        bool quit = false;
+        while (!quit) {
 
-        EVAF_INFO("%s is starting up", VER_MODULE_NAME_STR);
+            EVAF_INFO("%s is starting up", VER_MODULE_NAME_STR);
 
-        // Initialize the common library
-        if (!Common::init())
-            return 1;
+            // Initialize the common library
+            if (!Common::init())
+                return 1;
 
-        // Initialize the plugin manager and load plugins
-        if (!pluginManager.init())
-            return 1;
+            // Initialize the plugin manager and load plugins
+            if (!pluginManager.init())
+                return 1;
 
-        // Run the application
-        EVAF_INFO("Running %s", VER_MODULE_NAME_STR);
-        rval = Common::iApp::instance()->exec();
+            // Run the application
+            EVAF_INFO("Running %s", VER_MODULE_NAME_STR);
+            rval = Common::iApp::instance()->exec();
 
-        quit = rval != Common::iApp::RC_Restart;
+            quit = rval != Common::iApp::RC_Restart;
 
-        EVAF_INFO("%s is %s", VER_MODULE_NAME_STR, quit ? "exiting" : "restarting");
+            EVAF_INFO("%s is %s", VER_MODULE_NAME_STR, quit ? "exiting" : "restarting");
 
-        // Unload plugins and finalize the plugin manager
-        pluginManager.done();
+            // Unload plugins and finalize the plugin manager
+            pluginManager.done();
+
+            // Finalize the common library
+            Common::done();
+        }
     }
 
     EVAF_INFO("%s exit with code %d", VER_MODULE_NAME_STR, rval);