Skip to content

Commit

Permalink
main: make m_timer a unique_ptr
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Rusak <[email protected]>
  • Loading branch information
lrusak committed Apr 26, 2023
1 parent 4f7bc86 commit 1f7fcd4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ const BYTE PixelShader[] =
};
#endif

CMyAddon::CMyAddon()
: m_timer(nullptr)
{
}

////////////////////////////////////////////////////////////////////////////
// Kodi tells us we should get ready to start rendering. This function
// is called once when the screensaver is activated by Kodi.
Expand Down Expand Up @@ -128,7 +123,7 @@ bool CMyAddon::Start()
srand((u32)time(nullptr));
m_asteroids = std::make_unique<CAsteroids>(this);

m_timer = new CTimer();
m_timer = std::make_unique<CTimer>();
m_timer->Init();
if (!m_asteroids->RestoreDevice())
{
Expand Down Expand Up @@ -176,7 +171,6 @@ void CMyAddon::Stop()
#endif

m_asteroids->InvalidateDevice();
SAFE_DELETE(m_timer);

#ifndef WIN32
glBindBuffer(GL_ARRAY_BUFFER, 0);
Expand Down
4 changes: 2 additions & 2 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ATTR_DLL_LOCAL CMyAddon
#endif
{
public:
CMyAddon();
CMyAddon() = default;

bool Start() override;
void Stop() override;
Expand Down Expand Up @@ -86,7 +86,7 @@ class ATTR_DLL_LOCAL CMyAddon
#endif

std::unique_ptr<CAsteroids> m_asteroids;
CTimer* m_timer;
std::unique_ptr<CTimer> m_timer;
};

/***************************** I N L I N E S *******************************/

0 comments on commit 1f7fcd4

Please sign in to comment.