Prevent dangling pointers to meters...

... This stops a crash that might occur when the checkpoint thread causes
ProjectAudioManager::Stop() to execute but the project is in the process of
closing.
This commit is contained in:
Paul Licameli 2020-11-22 19:54:14 -05:00
parent 7fcd90e351
commit 2d6db518fa
2 changed files with 4 additions and 2 deletions

View File

@ -12,6 +12,7 @@ Paul Licameli split from AudacityProject.cpp
#include "AudioIOBase.h"
#include "Project.h"
#include "widgets/MeterPanelBase.h"
static const AudacityProject::AttachedObjects::RegisteredFactory sAudioIOKey{
[]( AudacityProject &parent ){

View File

@ -12,6 +12,7 @@ Paul Licameli split from AudacityProject.h
#define __PROJECT_AUDIO_IO__
#include "ClientData.h" // to inherit
#include <wx/weakref.h>
class AudacityProject;
class MeterPanelBase;
@ -43,8 +44,8 @@ private:
AudacityProject &mProject;
// Project owned meters
MeterPanelBase *mPlaybackMeter{};
MeterPanelBase *mCaptureMeter{};
wxWeakRef<MeterPanelBase> mPlaybackMeter{};
wxWeakRef<MeterPanelBase> mCaptureMeter{};
int mAudioIOToken{ -1 };
};