Commit 6504d775 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Improved crash window.

You can test it by using Tools -> crash :D
parent d48dc31e
...@@ -487,3 +487,8 @@ void MainWindow::keyboardShortcutChanged( const QString& name, const QString& ...@@ -487,3 +487,8 @@ void MainWindow::keyboardShortcutChanged( const QString& name, const QString&
else else
qWarning() << "Unknown shortcut:" << name; qWarning() << "Unknown shortcut:" << name;
} }
void MainWindow::on_actionCrash_triggered()
{
int test = 1 / 0;
}
...@@ -95,6 +95,7 @@ private slots: ...@@ -95,6 +95,7 @@ private slots:
void on_actionHelp_triggered(); void on_actionHelp_triggered();
void on_actionProject_Preferences_triggered(); void on_actionProject_Preferences_triggered();
void on_actionClose_Project_triggered(); void on_actionClose_Project_triggered();
void on_actionCrash_triggered();
void toolButtonClicked( int id ); void toolButtonClicked( int id );
void projectUpdated( const QString& projectName, bool savedStatus ); void projectUpdated( const QString& projectName, bool savedStatus );
void keyboardShortcutChanged( const QString&, const QString& ); void keyboardShortcutChanged( const QString&, const QString& );
......
...@@ -146,7 +146,6 @@ void PreviewWidget::endReached() ...@@ -146,7 +146,6 @@ void PreviewWidget::endReached()
void PreviewWidget::on_pushButtonNextFrame_clicked() void PreviewWidget::on_pushButtonNextFrame_clicked()
{ {
int test = 1 / 0;
if ( m_previewStopped == false ) if ( m_previewStopped == false )
m_renderer->nextFrame(); m_renderer->nextFrame();
} }
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<string>Tools</string> <string>Tools</string>
</property> </property>
<addaction name="actionTranscode"/> <addaction name="actionTranscode"/>
<addaction name="actionCrash"/>
</widget> </widget>
<widget class="QMenu" name="menuWindow"> <widget class="QMenu" name="menuWindow">
<property name="title"> <property name="title">
...@@ -212,6 +213,11 @@ ...@@ -212,6 +213,11 @@
<string>Close Project</string> <string>Close Project</string>
</property> </property>
</action> </action>
<action name="actionCrash">
<property name="text">
<string>Crash</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="../../../ressources.qrc"/> <include location="../../../ressources.qrc"/>
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
#include "ui_CrashHandler.h" #include "ui_CrashHandler.h"
#include <execinfo.h> #include <execinfo.h>
#include <signal.h>
CrashHandler::CrashHandler( int sig, QWidget *parent ) :
CrashHandler::CrashHandler( QWidget *parent ) :
QDialog( parent ), QDialog( parent ),
ui( new Ui::CrashHandler ) ui( new Ui::CrashHandler )
{ {
...@@ -37,9 +37,18 @@ CrashHandler::CrashHandler( QWidget *parent ) : ...@@ -37,9 +37,18 @@ CrashHandler::CrashHandler( QWidget *parent ) :
void *buff[CrashHandler::backtraceSize]; void *buff[CrashHandler::backtraceSize];
int nbSymb = backtrace( buff, CrashHandler::backtraceSize ); int nbSymb = backtrace( buff, CrashHandler::backtraceSize );
char** backtraceStr = backtrace_symbols( buff, nbSymb ); char** backtraceStr = backtrace_symbols( buff, nbSymb );
for ( unsigned int i = 0; i < nbSymb; ++i ) for ( int i = 0; i < nbSymb; ++i )
ui->backtraceDisplay->insertPlainText( QString( backtraceStr[i]) + "\n" ); ui->backtraceDisplay->insertPlainText( QString( backtraceStr[i]) + "\n" );
free(backtraceStr); free(backtraceStr);
QString sigName = tr( "Unknown signal" );
if ( sig == SIGSEGV )
sigName = "SIGSEGV (Segmentation Fault)";
if ( sig == SIGFPE )
sigName = "SIGFPE (Floating Exception)";
else
sigName = "Unknown";
ui->crashDescriptionLabel->setText( tr("A crash occured. Signal received: ") + sigName );
} }
CrashHandler::~CrashHandler() CrashHandler::~CrashHandler()
......
...@@ -35,7 +35,7 @@ class CrashHandler : public QDialog ...@@ -35,7 +35,7 @@ class CrashHandler : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
CrashHandler(QWidget *parent = 0); CrashHandler( int sig, QWidget *parent = 0 );
~CrashHandler(); ~CrashHandler();
protected: protected:
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>512</width>
<height>300</height> <height>370</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -99,39 +99,6 @@ ...@@ -99,39 +99,6 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QLabel" name="titleLabel">
<property name="text">
<string>VLMC Crash handler</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="3"> <item row="0" column="0" rowspan="3">
<widget class="QLabel" name="logoLabel"> <widget class="QLabel" name="logoLabel">
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -148,10 +115,27 @@ ...@@ -148,10 +115,27 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLabel" name="titleLabel">
<property name="text">
<string>VLMC Crash handler</string>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>An error occured. We're sorry for the inconvenient, though we saved your project. It will be reopened next time you open VLMC.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
...@@ -175,26 +159,26 @@ ...@@ -175,26 +159,26 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<spacer name="verticalSpacer"> <widget class="QTextEdit" name="backtraceDisplay">
<property name="orientation"> <property name="sizePolicy">
<enum>Qt::Vertical</enum> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="lineWrapMode">
<size> <enum>QTextEdit::NoWrap</enum>
<width>20</width>
<height>40</height>
</size>
</property> </property>
</spacer> <property name="readOnly">
</item> <bool>true</bool>
<item row="2" column="0"> </property>
<widget class="QTextEdit" name="backtraceDisplay"/> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="crashDescriptionLabel">
<property name="text"> <property name="text">
<string>TextLabel</string> <string>Crash_Description</string>
</property> </property>
</widget> </widget>
</item> </item>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <QtDebug> #include <QtDebug>
#include <QSettings> #include <QSettings>
#include <QMessageBox> #include <QMessageBox>
#include <QApplication>
#include <signal.h> #include <signal.h>
...@@ -39,9 +40,9 @@ void ProjectManager::signalHandler( int sig ) ...@@ -39,9 +40,9 @@ void ProjectManager::signalHandler( int sig )
ProjectManager::getInstance()->emergencyBackup(); ProjectManager::getInstance()->emergencyBackup();
CrashHandler* ch = new CrashHandler(); CrashHandler* ch = new CrashHandler( sig );
ch->exec(); ch->exec();
raise( sig ); QApplication::exit(1);
} }
const QString ProjectManager::unNamedProject = tr( "<Unnamed project>" ); const QString ProjectManager::unNamedProject = tr( "<Unnamed project>" );
......
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