1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Instantiate QNetworkAccessManager to avoid crash on reverse API usage

This commit is contained in:
Jon Beniston 2021-01-15 11:24:21 +00:00
parent 2c32224977
commit d507f49626
9 changed files with 36 additions and 0 deletions

View File

@ -54,10 +54,14 @@ AFC::AFC(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_worker = new AFCWorker(webAPIAdapterInterface);
m_state = StIdle;
m_errorMessage = "AFC error";
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
AFC::~AFC()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_worker->isRunning()) {
stop();
}

View File

@ -50,10 +50,14 @@ APRS::APRS(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_errorMessage = "APRS error";
connect(&m_updatePipesTimer, SIGNAL(timeout()), this, SLOT(updatePipes()));
m_updatePipesTimer.start(1000);
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
APRS::~APRS()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_worker->isRunning()) {
stop();
}

View File

@ -56,10 +56,14 @@ DemodAnalyzer::DemodAnalyzer(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_worker = new DemodAnalyzerWorker();
m_state = StIdle;
m_errorMessage = "DemodAnalyzer error";
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
DemodAnalyzer::~DemodAnalyzer()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_worker->isRunning()) {
stop();
}

View File

@ -56,10 +56,14 @@ GS232Controller::GS232Controller(WebAPIAdapterInterface *webAPIAdapterInterface)
m_selectedPipe = nullptr;
connect(&m_updatePipesTimer, SIGNAL(timeout()), this, SLOT(updatePipes()));
m_updatePipesTimer.start(1000);
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
GS232Controller::~GS232Controller()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_worker->isRunning()) {
stop();
}

View File

@ -49,10 +49,14 @@ Map::Map(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_errorMessage = "Map error";
connect(&m_updatePipesTimer, SIGNAL(timeout()), this, SLOT(updatePipes()));
m_updatePipesTimer.start(1000);
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
Map::~Map()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
}
bool Map::handleMessage(const Message& cmd)

View File

@ -45,10 +45,14 @@ RigCtlServer::RigCtlServer(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_worker = new RigCtlServerWorker(webAPIAdapterInterface);
m_state = StIdle;
m_errorMessage = "RigCtlServer error";
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
RigCtlServer::~RigCtlServer()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_worker->isRunning()) {
stop();
}

View File

@ -46,10 +46,14 @@ SimplePTT::SimplePTT(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_worker = new SimplePTTWorker(webAPIAdapterInterface);
m_state = StIdle;
m_errorMessage = "SimplePTT error";
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
SimplePTT::~SimplePTT()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_worker->isRunning()) {
stop();
}

View File

@ -45,10 +45,14 @@ StarTracker::StarTracker(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_worker = new StarTrackerWorker(this, webAPIAdapterInterface);
m_state = StIdle;
m_errorMessage = "StarTracker error";
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
StarTracker::~StarTracker()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_worker->isRunning()) {
stop();
}

View File

@ -53,10 +53,14 @@ VORLocalizer::VORLocalizer(WebAPIAdapterInterface *webAPIAdapterInterface) :
m_worker = new VorLocalizerWorker(webAPIAdapterInterface);
m_state = StIdle;
m_errorMessage = "VORLocalizer error";
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
VORLocalizer::~VORLocalizer()
{
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_worker->isRunning()) {
stop();
}