More fixes related to object destruction on exit

- _logBrowser is not delete on close, call deleteLater
- move writing geometry out of dtor.
- _folderWizard was unused, remove it and all related noops

Hopefully solves #945
This commit is contained in:
Daniel Molkentin 2013-09-20 14:18:28 +02:00
parent d0a4650d69
commit b0beeea95f
6 changed files with 31 additions and 8 deletions

View File

@ -23,7 +23,6 @@
#include "mirall/folder.h"
#include "mirall/folderman.h"
#include "mirall/folderwatcher.h"
#include "mirall/folderwizard.h"
#include "mirall/networklocation.h"
#include "mirall/folder.h"
#include "mirall/owncloudsetupwizard.h"
@ -228,11 +227,14 @@ void Application::slotCleanup()
{
// explicitly close windows. This is somewhat of a hack to ensure
// that saving the geometries happens ASAP during a OS shutdown
if (!_logBrowser.isNull()) _logBrowser->close();
// those do delete on close
if (!_settingsDialog.isNull()) _settingsDialog->close();
if (!_progressDialog.isNull()) _progressDialog->close();
if (!_folderWizard.isNull()) _folderWizard->close();
// those need an extra invitation
if (!_tray.isNull()) _tray->deleteLater();
if (!_logBrowser.isNull()) _logBrowser->deleteLater();
}
void Application::runValidator()

View File

@ -40,7 +40,6 @@ namespace Mirall {
class Theme;
class Folder;
class FolderWatcher;
class FolderWizard;
class ownCloudInfo;
class SslErrorDialog;
class SettingsDialog;
@ -134,7 +133,6 @@ private:
Theme *_theme;
QSignalMapper *_folderOpenActionMapper;
QPointer<FolderWizard> _folderWizard;
QPointer<LogBrowser>_logBrowser;
QPointer<SettingsDialog> _settingsDialog;
QPointer<ItemProgressDialog> _progressDialog;

View File

@ -127,11 +127,16 @@ LogBrowser::LogBrowser(QWidget *parent) :
}
LogBrowser::~LogBrowser()
{
}
void LogBrowser::closeEvent(QCloseEvent *)
{
MirallConfigFile cfg;
cfg.saveGeometry(this);
}
void LogBrowser::slotNewLog( const QString& msg )
{
if( _logWidget->isVisible() ) {

View File

@ -47,6 +47,9 @@ public:
void setLogFile(const QString& , bool );
protected:
void closeEvent(QCloseEvent *);
protected slots:
void slotNewLog( const QString &msg );
void slotFind();

View File

@ -118,9 +118,6 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
SettingsDialog::~SettingsDialog()
{
MirallConfigFile cfg;
cfg.saveGeometry(this);
delete _ui;
}
@ -145,4 +142,18 @@ void SettingsDialog::setGeneralErrors(const QStringList &errors)
_accountSettings->setGeneralErrors(errors);
}
// close event is not being called here
void SettingsDialog::reject() {
MirallConfigFile cfg;
cfg.saveGeometry(this);
QDialog::reject();
}
void SettingsDialog::accept() {
MirallConfigFile cfg;
cfg.saveGeometry(this);
QDialog::accept();
}
} // namespace Mirall

View File

@ -42,6 +42,10 @@ public:
void addAccount(const QString &title, QWidget *widget);
void setGeneralErrors( const QStringList& errors );
protected:
void reject();
void accept();
protected slots:
void slotUpdateAccountState();