mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
Merge pull request #4860 from lioncash/lock
FifoPlayerDlg: Use std::lock_guard instead of manual mutex locking/unlocking
This commit is contained in:
commit
e2706b4381
@ -47,9 +47,10 @@ FifoPlayerDlg::FifoPlayerDlg(wxWindow* const parent)
|
|||||||
{
|
{
|
||||||
CreateGUIControls();
|
CreateGUIControls();
|
||||||
|
|
||||||
sMutex.lock();
|
{
|
||||||
|
std::lock_guard<std::recursive_mutex> lock{sMutex};
|
||||||
m_EvtHandler = GetEventHandler();
|
m_EvtHandler = GetEventHandler();
|
||||||
sMutex.unlock();
|
}
|
||||||
|
|
||||||
FifoPlayer::GetInstance().SetFileLoadedCallback(FileLoaded);
|
FifoPlayer::GetInstance().SetFileLoadedCallback(FileLoaded);
|
||||||
FifoPlayer::GetInstance().SetFrameWrittenCallback(FrameWritten);
|
FifoPlayer::GetInstance().SetFrameWrittenCallback(FrameWritten);
|
||||||
@ -59,9 +60,8 @@ FifoPlayerDlg::~FifoPlayerDlg()
|
|||||||
{
|
{
|
||||||
FifoPlayer::GetInstance().SetFrameWrittenCallback(nullptr);
|
FifoPlayer::GetInstance().SetFrameWrittenCallback(nullptr);
|
||||||
|
|
||||||
sMutex.lock();
|
std::lock_guard<std::recursive_mutex> lock{sMutex};
|
||||||
m_EvtHandler = nullptr;
|
m_EvtHandler = nullptr;
|
||||||
sMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlayerDlg::CreateGUIControls()
|
void FifoPlayerDlg::CreateGUIControls()
|
||||||
@ -953,39 +953,33 @@ bool FifoPlayerDlg::GetSaveButtonEnabled() const
|
|||||||
|
|
||||||
void FifoPlayerDlg::RecordingFinished()
|
void FifoPlayerDlg::RecordingFinished()
|
||||||
{
|
{
|
||||||
sMutex.lock();
|
std::lock_guard<std::recursive_mutex> lock{sMutex};
|
||||||
|
|
||||||
if (m_EvtHandler)
|
if (m_EvtHandler)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(RECORDING_FINISHED_EVENT);
|
wxCommandEvent event(RECORDING_FINISHED_EVENT);
|
||||||
m_EvtHandler->AddPendingEvent(event);
|
m_EvtHandler->AddPendingEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
sMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlayerDlg::FileLoaded()
|
void FifoPlayerDlg::FileLoaded()
|
||||||
{
|
{
|
||||||
sMutex.lock();
|
std::lock_guard<std::recursive_mutex> lock{sMutex};
|
||||||
|
|
||||||
if (m_EvtHandler)
|
if (m_EvtHandler)
|
||||||
{
|
{
|
||||||
wxPaintEvent event;
|
wxPaintEvent event;
|
||||||
m_EvtHandler->AddPendingEvent(event);
|
m_EvtHandler->AddPendingEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
sMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoPlayerDlg::FrameWritten()
|
void FifoPlayerDlg::FrameWritten()
|
||||||
{
|
{
|
||||||
sMutex.lock();
|
std::lock_guard<std::recursive_mutex> lock{sMutex};
|
||||||
|
|
||||||
if (m_EvtHandler)
|
if (m_EvtHandler)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(FRAME_WRITTEN_EVENT);
|
wxCommandEvent event(FRAME_WRITTEN_EVENT);
|
||||||
m_EvtHandler->AddPendingEvent(event);
|
m_EvtHandler->AddPendingEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
sMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user