mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-27 09:58:08 +01:00
Fixed a few memory leaks
This commit is contained in:
parent
0a2727e767
commit
f3f2d916bb
3 changed files with 18 additions and 3 deletions
|
@ -54,6 +54,7 @@ string StackTrace::GetStack()
|
||||||
{
|
{
|
||||||
oss << " at " << Demangle(symbols[i]) << endl;
|
oss << " at " << Demangle(symbols[i]) << endl;
|
||||||
}
|
}
|
||||||
|
free (symbols);
|
||||||
|
|
||||||
return oss.str();
|
return oss.str();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -118,13 +118,13 @@ MainWindow::MainWindow(QWidget *iParent)
|
||||||
// Status bar
|
// Status bar
|
||||||
statusBar()->addWidget(new QLabel, 1);
|
statusBar()->addWidget(new QLabel, 1);
|
||||||
// First widget, not added yet
|
// First widget, not added yet
|
||||||
m_lettersLabel = new QLabel;
|
m_lettersLabel = new QLabel(statusBar());
|
||||||
m_lettersLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
|
m_lettersLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
|
||||||
// Second widget, not added yet
|
// Second widget, not added yet
|
||||||
m_turnLabel = new QLabel;
|
m_turnLabel = new QLabel(statusBar());
|
||||||
m_turnLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
|
m_turnLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
|
||||||
// Third widget
|
// Third widget
|
||||||
m_dicNameLabel = new QLabel;
|
m_dicNameLabel = new QLabel(this);
|
||||||
m_dicNameLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
|
m_dicNameLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
|
||||||
statusBar()->addPermanentWidget(m_dicNameLabel);
|
statusBar()->addPermanentWidget(m_dicNameLabel);
|
||||||
QObject::connect(this, SIGNAL(dicChanged(const Dictionary*)),
|
QObject::connect(this, SIGNAL(dicChanged(const Dictionary*)),
|
||||||
|
@ -202,6 +202,10 @@ MainWindow::~MainWindow()
|
||||||
delete m_game;
|
delete m_game;
|
||||||
delete m_dic;
|
delete m_dic;
|
||||||
delete m_timerModel;
|
delete m_timerModel;
|
||||||
|
|
||||||
|
// Destroy singletons
|
||||||
|
GameFactory::Destroy();
|
||||||
|
Settings::Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,15 @@ wchar_t *rl_gets()
|
||||||
delete[] wline_read;
|
delete[] wline_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool init = true;
|
||||||
|
if (init)
|
||||||
|
{
|
||||||
|
// Initialize readline() explicitly, to help filtering
|
||||||
|
// valgrind results
|
||||||
|
rl_initialize();
|
||||||
|
init = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Get a line from the user
|
// Get a line from the user
|
||||||
static char *line_read;
|
static char *line_read;
|
||||||
line_read = readline("commande> ");
|
line_read = readline("commande> ");
|
||||||
|
@ -944,6 +953,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
mainLoop(dic);
|
mainLoop(dic);
|
||||||
GameFactory::Destroy();
|
GameFactory::Destroy();
|
||||||
|
Settings::Destroy();
|
||||||
|
|
||||||
// Free the readline static variable
|
// Free the readline static variable
|
||||||
if (wline_read)
|
if (wline_read)
|
||||||
|
|
Loading…
Reference in a new issue