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

HeatMap: Catch memory allocation failures when adding data to the chart and disable it. For #2083

This commit is contained in:
Jon Beniston 2024-10-11 13:16:04 +01:00
parent f24600b909
commit 1654642fdb

View File

@ -1505,6 +1505,8 @@ void HeatMapGUI::plotPowerVsTimeChart()
void HeatMapGUI::addToPowerSeries(QDateTime dateTime, double average, double pulseAverage, double max, double min, double pathLoss) void HeatMapGUI::addToPowerSeries(QDateTime dateTime, double average, double pulseAverage, double max, double min, double pathLoss)
{ {
if (m_powerAverageSeries) if (m_powerAverageSeries)
{
try
{ {
qint64 msecs = dateTime.toMSecsSinceEpoch(); qint64 msecs = dateTime.toMSecsSinceEpoch();
if (!std::isnan(average)) { if (!std::isnan(average)) {
@ -1523,6 +1525,12 @@ void HeatMapGUI::addToPowerSeries(QDateTime dateTime, double average, double pul
m_powerPathLossSeries->append(msecs, pathLoss); m_powerPathLossSeries->append(msecs, pathLoss);
} }
} }
catch (std::bad_alloc&)
{
QMessageBox::critical(this, "Heat Map", QString("Failed to allocate memory for chart series"));
ui->displayChart->setChecked(false);
}
}
} }
void HeatMapGUI::updateAxis() void HeatMapGUI::updateAxis()