Commit b2696218 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Adding os-specific main, to be abble to relaunch vlmc in case of crash.

This should work but hasn't been fully tested on win32, due to outdated contribs.
This will, in any case, disable restart functionnality on win32 for now.
parent 5fe8f854
......@@ -106,6 +106,12 @@ SET(VLMC_SRCS
Workflow/VideoClipWorkflow.cpp
)
IF (WIN32)
LIST ( APPEND VLMC_SRCS winvlmc.cpp )
ELSE (WIN32)
LIST( APPEND VLMC_SRCS vlmc.cpp )
ENDIF(WIN32)
SET (VLMC_HDRS
Actions/StackedAction.h
Commands/KeyboardShortcutHelper.h
......
......@@ -39,8 +39,6 @@ class ImportController;
class WorkflowFileRenderer;
class WorkflowRenderer;
#define DEBUG_CRASHHANDLER
class MainWindow : public QMainWindow
{
Q_OBJECT
......
......@@ -32,9 +32,6 @@
#include <QColor>
#include <QPalette>
#include <QSettings>
#include <QtDebug>
#include <wait.h>
#ifndef VLMC_VERSION
#define VLMC_VERSION Unknown
......@@ -97,31 +94,3 @@ VLMCmain( 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.";
}
}
}
/*****************************************************************************
* vlmc.cpp: VLMC launcher for unix
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtDebug>
#include <wait.h>
#include <unistd.h>
int VLMCmain( int , char** );
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.";
}
}
}
/*****************************************************************************
* winvlmc.cpp: VLMC launcher for win32
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <windows.h>
int VLMCmain( int, char** );
LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo)
{
if(IsDebuggerPresent())
{
//If a debugger is present, pass the exception to the debugger with EXCEPTION_CONTINUE_SEARCH
return EXCEPTION_CONTINUE_SEARCH;
}
//TODO: get backtrace
//TODO: relaunch ?
return ;
}
int main( int argc, char **argv )
{
VLMCmain( argc, argv );
}
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