Commit 5fe8f854 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Forking in vlmc to avoid having a launcher

parent 9da7edf9
......@@ -39,6 +39,8 @@ class ImportController;
class WorkflowFileRenderer;
class WorkflowRenderer;
#define DEBUG_CRASHHANDLER
class MainWindow : public QMainWindow
{
Q_OBJECT
......
......@@ -32,6 +32,9 @@
#include <QColor>
#include <QPalette>
#include <QSettings>
#include <QtDebug>
#include <wait.h>
#ifndef VLMC_VERSION
#define VLMC_VERSION Unknown
......@@ -48,7 +51,7 @@
* \return Return value of vlmc
*/
int
main( int argc, char **argv )
VLMCmain( int argc, char **argv )
{
QApplication app( argc, argv );
app.setApplicationName( "vlmc" );
......@@ -94,3 +97,31 @@ main( int argc, char **argv )
w.show();
return app.exec();
}
int main( int argc, char **argv )
{
while ( true )
{
pid_t pid = fork();
if ( pid < 0 )
qFatal("Can't fork to launch VLMC. Exiting.");
if ( pid == 0 )
return VLMCmain( argc, argv );
else
{
int status;
wait( &status );
if ( WIFEXITED(status) )
{
int ret = WEXITSTATUS( status );
if ( ret == 2 )
continue ;
else
break ;
}
else
qCritical() << "Unhandled crash.";
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment