Commit 6fdacc23 authored by Clément Vuchener's avatar Clément Vuchener

Correction d'une seg fault au démarrage

parent 98a0f52b
......@@ -25,13 +25,14 @@ Interface_console::Interface_console(int argc, char ** argv){
int state;
bool useGUI;/* if window interface can be displayed */
QDir current_directory;
QString current_path;
current_path = current_directory.currentPath();
_run_env[0] = (char *)malloc(current_path.length()*sizeof(char));
app = new QApplication(argc, argv);/* create the Qt application */
current_path = QDir::currentPath();
_run_env[0] = new char[current_path.length()+1];
if (!strcpy(_run_env[0], current_path.toStdString().c_str())) {
cerr << "Error : in " << __FILE__ << " at line " << __LINE__ << "." << endl;
cerr << "Reason : Copy of the current path directory failed." << endl;
......@@ -43,8 +44,8 @@ Interface_console::Interface_console(int argc, char ** argv){
Message::set_interface(this);/* define which interface will receive messages */
useGUI = true;
app = new QApplication(argc, argv, useGUI);/* create the Qt application */
// argc = 1;
/* Qt uses the default system encoding for QString (used when opening a file) */
QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
......@@ -60,7 +61,7 @@ Interface_console::Interface_console(int argc, char ** argv){
// Init of the times
_time_start = 0;
_time_end = 0;
state = get_state(argc, argv);
launch_action(state);
......@@ -332,10 +333,10 @@ void Interface_console::launch_action(int state, void* arg){
case _STATE_LAUNCH_GRAPHICAL_INTERFACE :
_main_window = new Interface_graphic(this);/* launch the window interface */
Message::set_interface(_main_window);/* define which interface will receive messages */
_render_opengl = new Render_opengl(_main_window);
_main_window->bind_render_area((QGLWidget*)_render_opengl);
_main_window = new Interface_graphic(this);/* launch the window interface */
Message::set_interface(_main_window);/* define which interface will receive messages */
_render_opengl = new Render_opengl(_main_window);
_main_window->bind_render_area((QGLWidget*)_render_opengl);
break;
......
......@@ -14,9 +14,10 @@
*\brief The main function of ViTE.
*/
int main(int argc, char **argv) {
Q_INIT_RESOURCE(vite);
glutInit(&argc, argv);
Interface_console console(argc, argv);
return console.run();
}
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