Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HeatMap: Fix crash when out of memory #2277

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions plugins/channelrx/heatmap/heatmapgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,21 +1506,29 @@ void HeatMapGUI::addToPowerSeries(QDateTime dateTime, double average, double pul
{
if (m_powerAverageSeries)
{
qint64 msecs = dateTime.toMSecsSinceEpoch();
if (!std::isnan(average)) {
m_powerAverageSeries->append(msecs, average);
}
if (!std::isnan(pulseAverage)) {
m_powerPulseAverageSeries->append(msecs, pulseAverage);
}
if (!std::isnan(max)) {
m_powerMaxPeakSeries->append(msecs, max);
}
if (!std::isnan(min)) {
m_powerMinPeakSeries->append(msecs, min);
try
{
qint64 msecs = dateTime.toMSecsSinceEpoch();
if (!std::isnan(average)) {
m_powerAverageSeries->append(msecs, average);
}
if (!std::isnan(pulseAverage)) {
m_powerPulseAverageSeries->append(msecs, pulseAverage);
}
if (!std::isnan(max)) {
m_powerMaxPeakSeries->append(msecs, max);
}
if (!std::isnan(min)) {
m_powerMinPeakSeries->append(msecs, min);
}
if (!std::isnan(pathLoss)) {
m_powerPathLossSeries->append(msecs, pathLoss);
}
}
if (!std::isnan(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);
}
}
}
Expand Down
Loading