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 @@ ...@@ -29,6 +29,36 @@
int VLMCmain( int , char** ); 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 ) int main( int argc, char **argv )
{ {
#ifdef WITH_CRASHHANDLER #ifdef WITH_CRASHHANDLER
...@@ -38,7 +68,13 @@ int main( int argc, char **argv ) ...@@ -38,7 +68,13 @@ int main( int argc, char **argv )
if ( pid < 0 ) if ( pid < 0 )
qFatal("Can't fork to launch VLMC. Exiting."); qFatal("Can't fork to launch VLMC. Exiting.");
if ( pid == 0 ) if ( pid == 0 )
{
signal( SIGSEGV, signalHandler );
signal( SIGFPE, signalHandler );
signal( SIGABRT, signalHandler );
signal( SIGILL, signalHandler );
return VLMCmain( argc, argv ); return VLMCmain( argc, argv );
}
else else
{ {
int status; int status;
......
...@@ -22,15 +22,6 @@ ...@@ -22,15 +22,6 @@
#include "config.h" #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 "Library.h"
#include "MainWorkflow.h" #include "MainWorkflow.h"
#include "project/GuiProjectManager.h" #include "project/GuiProjectManager.h"
...@@ -45,26 +36,6 @@ ...@@ -45,26 +36,6 @@
#include <errno.h> #include <errno.h>
#include <signal.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::unNamedProject = tr( "<Unnamed project>" );
const QString ProjectManager::unSavedProject = tr( "<Unsaved project>" ); const QString ProjectManager::unSavedProject = tr( "<Unsaved project>" );
...@@ -73,13 +44,6 @@ ProjectManager::ProjectManager() : m_projectFile( NULL ), m_needSave( false ) ...@@ -73,13 +44,6 @@ ProjectManager::ProjectManager() : m_projectFile( NULL ), m_needSave( false )
QSettings s; QSettings s;
m_recentsProjects = s.value( "RecentsProjects" ).toStringList(); 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_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/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" ); VLMC_CREATE_PROJECT_INT( "video/VideoProjectHeight", 300, "Video height", "Height resolution of the output video" );
......
...@@ -50,8 +50,7 @@ public: ...@@ -50,8 +50,7 @@ public:
virtual bool closeProject(); virtual bool closeProject();
virtual void saveProject( bool saveAs = false ); virtual void saveProject( bool saveAs = false );
bool loadEmergencyBackup(); bool loadEmergencyBackup();
void emergencyBackup();
static void signalHandler( int sig );
protected: protected:
/** /**
...@@ -59,7 +58,6 @@ protected: ...@@ -59,7 +58,6 @@ protected:
* It's only purpose it to write the project for very specific cases. * It's only purpose it to write the project for very specific cases.
*/ */
void __saveProject( const QString& fileName ); void __saveProject( const QString& fileName );
void emergencyBackup();
static bool isBackupFile( const QString& projectFile ); static bool isBackupFile( const QString& projectFile );
void appendToRecentProject( const QString& projectName ); 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