GUI: Fixed help window leaks and made sure it is closed when the gui is closed

This commit is contained in:
Daniel Marjamäki 2010-08-21 11:02:52 +02:00
parent 9c594684db
commit 65c5b9906e
2 changed files with 17 additions and 2 deletions

View File

@ -43,6 +43,7 @@ MainWindow::MainWindow() :
mTranslation(new TranslationHandler(this)),
mLanguages(new QActionGroup(this)),
mLogView(NULL),
mHelpWindow(NULL),
mExiting(false)
{
mUI.setupUi(this);
@ -110,6 +111,7 @@ MainWindow::MainWindow() :
MainWindow::~MainWindow()
{
delete mLogView;
delete mHelpWindow;
}
void MainWindow::CreateLanguageMenuItems()
@ -457,6 +459,9 @@ void MainWindow::closeEvent(QCloseEvent *event)
// Check that we aren't checking files
if (!mThread->IsChecking())
{
delete mHelpWindow;
mHelpWindow = NULL;
SaveSettings();
event->accept();
}
@ -652,8 +657,12 @@ void MainWindow::OpenHelpContents()
void MainWindow::OpenHtmlHelpContents()
{
HelpWindow *helpWindow = new HelpWindow;
helpWindow->setVisible(true);
if (mHelpWindow == NULL)
mHelpWindow = new HelpWindow;
mHelpWindow->show();
if (!mHelpWindow->isActiveWindow())
mHelpWindow->activateWindow();
}
void MainWindow::OpenProjectFile()

View File

@ -33,6 +33,7 @@
#include "ui_main.h"
class ThreadHandler;
class LogView;
class HelpWindow;
/// @addtogroup GUI
/// @{
@ -327,6 +328,11 @@ protected:
*/
LogView *mLogView;
/**
* @brief Help window..
*/
HelpWindow *mHelpWindow;
private:
/**