Initialize pointers to null on creation

Fixes access violation in hello_world.ppu.elf on window close.
As I understood the reason - when dtor of XAudioThread is called it
checks:
if (m_source_voice) Quit();
But m_source_voice isn't initialized to 0 by default so when in Quit()
in tries to call some funcs from unitialized ptrs and access violation
happens.
This commit is contained in:
Danila Malyutin 2015-06-02 02:28:04 +03:00 committed by Nekotekina
parent 6ce793d582
commit 8483b17995
2 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,10 @@ XAudio2Thread::~XAudio2Thread()
if (m_source_voice) Quit();
}
XAudio2Thread::XAudio2Thread() : m_xaudio2_instance(nullptr), m_master_voice(nullptr), m_source_voice(nullptr)
{
}
void XAudio2Thread::Init()
{
HRESULT hr = S_OK;

View File

@ -14,6 +14,7 @@ private:
public:
virtual ~XAudio2Thread();
XAudio2Thread();
virtual void Init();
virtual void Quit();