Commit 051fa09b authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Unix Crash handling: Moving stuff to a more appropriate place

parent 64ed8cfe
......@@ -29,6 +29,36 @@
int VLMCmain( int , char** );
#if defined(WITH_CRASHHANDLER) && defined(Q_OS_UNIX)
# ifdef WITH_GUI
# include "project/GuiProjectManager.h"
# ifdef WITH_CRASHHANDLER_GUI
# include "CrashHandler.h"
# endif
# else
# include "ProjectManager.h"
#endif
void signalHandler( int sig )
{
signal( sig, SIG_DFL );
#ifdef WITH_GUI
GUIProjectManager::getInstance()->emergencyBackup();
#else
ProjectManager::getInstance()->emergencyBackup();
#endif
#ifdef WITH_CRASHHANDLER_GUI
CrashHandler* ch = new CrashHandler( sig );
::exit( ch->exec() );
#else
::exit( 1 );
#endif
}
#endif
int main( int argc, char **argv )
{
#ifdef WITH_CRASHHANDLER
......@@ -38,7 +68,13 @@ int main( int argc, char **argv )
if ( pid < 0 )
qFatal("Can't fork to launch VLMC. Exiting.");
if ( pid == 0 )
{
signal( SIGSEGV, signalHandler );
signal( SIGFPE, signalHandler );
signal( SIGABRT, signalHandler );
signal( SIGILL, signalHandler );
return VLMCmain( argc, argv );
}
else
{
int status;
......
......@@ -22,15 +22,6 @@
#include "config.h"
#ifdef WITH_GUI
# ifdef WITH_CRASHHANDLER_GUI
# include "CrashHandler.h"
# endif
#else
//We shouldn't have to do this.
#undef WITH_CRASHHANDLER_GUI
#endif
#include "Library.h"
#include "MainWorkflow.h"
#include "project/GuiProjectManager.h"
......@@ -45,26 +36,6 @@
#include <errno.h>
#include <signal.h>
#ifdef WITH_CRASHHANDLER
void ProjectManager::signalHandler( int sig )
{
signal( sig, SIG_DFL );
#ifdef WITH_GUI
GUIProjectManager::getInstance()->emergencyBackup();
#else
ProjectManager::getInstance()->emergencyBackup();
#endif
#ifdef WITH_CRASHHANDLER_GUI
CrashHandler* ch = new CrashHandler( sig );
::exit( ch->exec() );
#else
::exit( 1 );
#endif
}
#endif
const QString ProjectManager::unNamedProject = tr( "<Unnamed project>" );
const QString ProjectManager::unSavedProject = tr( "<Unsaved project>" );
......@@ -73,13 +44,6 @@ ProjectManager::ProjectManager() : m_projectFile( NULL ), m_needSave( false )
QSettings s;
m_recentsProjects = s.value( "RecentsProjects" ).toStringList();
#ifdef WITH_CRASHHANDLER
signal( SIGSEGV, ProjectManager::signalHandler );
signal( SIGFPE, ProjectManager::signalHandler );
signal( SIGABRT, ProjectManager::signalHandler );
signal( SIGILL, ProjectManager::signalHandler );
#endif
VLMC_CREATE_PROJECT_DOUBLE( "video/VLMCOutputFPS", 29.97, "Output video FPS", "Frame Per Second used when previewing and rendering the project" );
VLMC_CREATE_PROJECT_INT( "video/VideoProjectWidth", 480, "Video width", "Width resolution of the output video" );
VLMC_CREATE_PROJECT_INT( "video/VideoProjectHeight", 300, "Video height", "Height resolution of the output video" );
......
......@@ -50,8 +50,7 @@ public:
virtual bool closeProject();
virtual void saveProject( bool saveAs = false );
bool loadEmergencyBackup();
static void signalHandler( int sig );
void emergencyBackup();
protected:
/**
......@@ -59,7 +58,6 @@ protected:
* It's only purpose it to write the project for very specific cases.
*/
void __saveProject( const QString& fileName );
void emergencyBackup();
static bool isBackupFile( const QString& projectFile );
void appendToRecentProject( const QString& projectName );
/**
......
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