mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-02 05:07:53 -04:00
Fix a DemodulatorInstance dangling reference
This commit is contained in:
parent
03bf38fea8
commit
dc9c67bec1
@ -60,7 +60,7 @@ std::vector<std::string> str_explode(const std::string &seperator, const std::st
|
|||||||
#define APPFRAME_MODEMPROPS_MAXSIZE 240
|
#define APPFRAME_MODEMPROPS_MAXSIZE 240
|
||||||
|
|
||||||
AppFrame::AppFrame() :
|
AppFrame::AppFrame() :
|
||||||
wxFrame(NULL, wxID_ANY, CUBICSDR_TITLE), activeDemodulator(NULL) {
|
wxFrame(NULL, wxID_ANY, CUBICSDR_TITLE), activeDemodulator(nullptr) {
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
SetIcon(wxICON(cubicsdr));
|
SetIcon(wxICON(cubicsdr));
|
||||||
@ -1734,7 +1734,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
wxGetApp().getDemodMgr().setLastBandwidth(demod->getBandwidth());
|
wxGetApp().getDemodMgr().setLastBandwidth(demod->getBandwidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (demod != activeDemodulator) {
|
if (demod.get() != activeDemodulator) {
|
||||||
demodSignalMeter->setInputValue(demod->getSquelchLevel());
|
demodSignalMeter->setInputValue(demod->getSquelchLevel());
|
||||||
demodGainMeter->setInputValue(demod->getGain());
|
demodGainMeter->setInputValue(demod->getGain());
|
||||||
wxGetApp().getDemodMgr().setLastGain(demod->getGain());
|
wxGetApp().getDemodMgr().setLastGain(demod->getGain());
|
||||||
@ -1878,7 +1878,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
demod->setGain(demodGainMeter->getInputValue());
|
demod->setGain(demodGainMeter->getInputValue());
|
||||||
demodGainMeter->setLevel(demodGainMeter->getInputValue());
|
demodGainMeter->setLevel(demodGainMeter->getInputValue());
|
||||||
}
|
}
|
||||||
activeDemodulator = demod;
|
activeDemodulator = demod.get();
|
||||||
} else if (demod) {
|
} else if (demod) {
|
||||||
// Wait state for current demodulator modem to activate..
|
// Wait state for current demodulator modem to activate..
|
||||||
} else {
|
} else {
|
||||||
|
@ -194,7 +194,8 @@ private:
|
|||||||
wxBoxSizer *demodTray;
|
wxBoxSizer *demodTray;
|
||||||
BookmarkView *bookmarkView;
|
BookmarkView *bookmarkView;
|
||||||
|
|
||||||
DemodulatorInstancePtr activeDemodulator;
|
//Use a raw pointer here to prevent a dangling reference
|
||||||
|
DemodulatorInstance* activeDemodulator;
|
||||||
|
|
||||||
std::vector<RtAudio::DeviceInfo> devices;
|
std::vector<RtAudio::DeviceInfo> devices;
|
||||||
std::map<int,RtAudio::DeviceInfo> inputDevices;
|
std::map<int,RtAudio::DeviceInfo> inputDevices;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user