Commit 775a7096 authored by Laurent Montel's avatar Laurent Montel 😁

Fix crash when we close apps

parent d432db35
......@@ -59,6 +59,5 @@ int main(int argc, char **argv)
ThemeEditorMainWindow *mw = new ThemeEditorMainWindow;
mw->show();
const int ret = app.exec();
delete mw;
return ret;
}
......@@ -52,6 +52,10 @@ ThemeEditorMainWindow::ThemeEditorMainWindow()
}
ThemeEditorMainWindow::~ThemeEditorMainWindow()
{
}
void ThemeEditorMainWindow::writeConfig()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
......@@ -293,6 +297,7 @@ void ThemeEditorMainWindow::closeEvent(QCloseEvent *e)
if (!saveCurrentProject(SaveAndCloseTheme)) {
e->ignore();
} else {
writeConfig();
e->accept();
}
}
......@@ -300,6 +305,7 @@ void ThemeEditorMainWindow::closeEvent(QCloseEvent *e)
void ThemeEditorMainWindow::slotQuitApp()
{
if (saveCurrentProject(SaveAndCloseTheme)) {
writeConfig();
qApp->quit();
}
}
......
......@@ -62,6 +62,7 @@ private:
};
bool loadTheme(const QString &directory);
void writeConfig();
void readConfig();
void updateActions();
bool saveCurrentProject(ActionSaveTheme act);
......
......@@ -65,6 +65,5 @@ int main(int argc, char **argv)
ThemeEditorMainWindow *mw = new ThemeEditorMainWindow();
mw->show();
const int ret = app.exec();
delete mw;
return ret;
}
......@@ -51,6 +51,10 @@ ThemeEditorMainWindow::ThemeEditorMainWindow()
}
ThemeEditorMainWindow::~ThemeEditorMainWindow()
{
}
void ThemeEditorMainWindow::writeConfig()
{
KSharedConfig::Ptr config = KSharedConfig::openConfig();
......@@ -316,6 +320,7 @@ void ThemeEditorMainWindow::closeEvent(QCloseEvent *e)
if (!saveCurrentProject(SaveAndCloseTheme)) {
e->ignore();
} else {
writeConfig();
e->accept();
}
}
......@@ -323,6 +328,7 @@ void ThemeEditorMainWindow::closeEvent(QCloseEvent *e)
void ThemeEditorMainWindow::slotQuitApp()
{
if (saveCurrentProject(SaveAndCloseTheme)) {
writeConfig();
qApp->quit();
}
}
......
......@@ -65,6 +65,7 @@ private:
bool loadTheme(const QString &directory);
void readConfig();
void writeConfig();
void updateActions();
bool saveCurrentProject(ActionSaveTheme act);
void setupActions();
......
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