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

pull/2277/head
Jon Beniston 2024-10-11 13:16:04 +01:00
rodzic f24600b909
commit 1654642fdb
1 zmienionych plików z 22 dodań i 14 usunięć

Wyświetl plik

@ -1505,6 +1505,8 @@ void HeatMapGUI::plotPowerVsTimeChart()
void HeatMapGUI::addToPowerSeries(QDateTime dateTime, double average, double pulseAverage, double max, double min, double pathLoss)
{
if (m_powerAverageSeries)
{
try
{
qint64 msecs = dateTime.toMSecsSinceEpoch();
if (!std::isnan(average)) {
@ -1523,6 +1525,12 @@ void HeatMapGUI::addToPowerSeries(QDateTime dateTime, double average, double pul
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()