Skip to content

Commit

Permalink
CScreensaverMatrixTrails: use unique_ptr for m_timer
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
  • Loading branch information
lrusak committed Apr 20, 2023
1 parent 50245ef commit 6481fda
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ATTR_DLL_LOCAL CScreensaverMatrixTrails

private:
std::unique_ptr<CMatrixTrails> m_matrixTrails;
CTimer* m_timer;
std::unique_ptr<CTimer> m_timer;
CConfig m_config;
};

Expand All @@ -42,7 +42,6 @@ class ATTR_DLL_LOCAL CScreensaverMatrixTrails
// here and load any settings we may have from our config file
//
CScreensaverMatrixTrails::CScreensaverMatrixTrails()
: m_timer(nullptr)
{
m_config.SetDefaults();
m_config.m_NumColumns = kodi::addon::GetSettingInt("columns");
Expand All @@ -65,7 +64,7 @@ bool CScreensaverMatrixTrails::Start()

m_matrixTrails = std::make_unique<CMatrixTrails>(&m_config);

m_timer = new CTimer();
m_timer = std::make_unique<CTimer>();
m_timer->Init();
m_timer->SetSpeed(static_cast<f32>(kodi::addon::GetSettingInt("speed")));
std::string path = kodi::addon::GetAddonPath() + "/resources/MatrixTrails.tga";
Expand All @@ -86,7 +85,6 @@ void CScreensaverMatrixTrails::Stop()
if (!m_matrixTrails)
return;
m_matrixTrails->InvalidateDevice();
SAFE_DELETE(m_timer);
}

////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 6481fda

Please sign in to comment.