Commit ef45841c authored by Marius Pa's avatar Marius Pa
Browse files

highscoredialog method "showLevel" should not call dtor of this

Revealed by PVS-Studio issue "blinken.cpp:351: error: V773 Visibility
scope of the 'hsd' pointer was exited without releasing the memory.
A memory leak is possible.".
parent c226950d
Pipeline #213793 passed with stage
in 1 minute and 40 seconds
......@@ -345,8 +345,8 @@ void blinken::mousePressEvent(QMouseEvent *e)
{
if (m_overHighscore || m_overCounter)
{
highScoreDialog *hsd = new highScoreDialog(this, m_renderer);
hsd->showLevel(1);
highScoreDialog hsd(this, m_renderer);
hsd.showLevel(1);
m_updateButtonHighlighting = true;
}
else if (m_showPreferences && m_fontRect.contains(e -> pos()) && !m_alwaysUseNonCoolFont)
......@@ -418,8 +418,8 @@ void blinken::checkHS()
m_lastName = name;
hsm.addScore(m_game.level(), m_game.score(), name);
}
highScoreDialog *hsd = new highScoreDialog(this, m_renderer);
hsd->showLevel(m_game.level());
highScoreDialog hsd(this, m_renderer);
hsd.showLevel(m_game.level());
}
}
......
......@@ -164,7 +164,6 @@ void highScoreDialog::showLevel(int level)
if (max.width() < m_tw -> tabBarSizeHint().width() + 5) m_tw -> setMinimumSize(m_tw -> tabBarSizeHint().width() + 5, max.height() + m_tw -> tabBarSizeHint().height() + 5);
exec();
delete this;
}
/* highScoreManager */
......
Supports Markdown
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