From 8a73abf63f9f487c319285c319c499e6db64dd74 Mon Sep 17 00:00:00 2001 From: xarkes Date: Wed, 7 Mar 2018 11:49:40 +0100 Subject: [PATCH] Fixed SegFault when closing LoadOptions dialog --- src/MainWindow.cpp | 1 - src/dialogs/SaveProjectDialog.cpp | 15 ++++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 737cd74e..155e9bb0 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -99,7 +99,6 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { - delete configuration; } void MainWindow::initUI() diff --git a/src/dialogs/SaveProjectDialog.cpp b/src/dialogs/SaveProjectDialog.cpp index 8985098d..5c295c40 100644 --- a/src/dialogs/SaveProjectDialog.cpp +++ b/src/dialogs/SaveProjectDialog.cpp @@ -4,6 +4,7 @@ #include #include "SaveProjectDialog.h" #include "ui_SaveProjectDialog.h" +#include "utils/TempConfig.h" SaveProjectDialog::SaveProjectDialog(bool quit, QWidget *parent) : QDialog(parent), @@ -82,12 +83,12 @@ void SaveProjectDialog::on_buttonBox_clicked(QAbstractButton *button) void SaveProjectDialog::accept() { - CutterCore *core = CutterCore::getInstance(); - core->setConfig("dir.projects", ui->projectsDirEdit->text().toUtf8().constData()); - core->setConfig("prj.simple", ui->simpleCheckBox->isChecked()); - core->setConfig("prj.files", ui->filesCheckBox->isChecked()); - core->setConfig("prj.git", ui->gitCheckBox->isChecked()); - core->setConfig("prj.zip", ui->zipCheckBox->isChecked()); + TempConfig tempConfig; + tempConfig.set("dir.projects", ui->projectsDirEdit->text().toUtf8().constData()) + .set("prj.simple", ui->simpleCheckBox->isChecked()) + .set("prj.files", ui->filesCheckBox->isChecked()) + .set("prj.git", ui->gitCheckBox->isChecked()) + .set("prj.zip", ui->zipCheckBox->isChecked()); QString projectName = ui->nameEdit->text().trimmed(); if(!CutterCore::isProjectNameValid(projectName)) @@ -96,7 +97,7 @@ void SaveProjectDialog::accept() return; } - core->saveProject(projectName); + Core()->saveProject(projectName); QDialog::done(Saved); }