# HG changeset patch # User Chris Cannam # Date 1163429337 0 # Node ID 05015e717a0d72be3d0d1bbd941ffd1d7ae52693 # Parent dbd34ff746c7cee472b2c5ca9010424ff74c30df * Somewhat better handling of running out of memory or disc space diff -r dbd34ff746c7 -r 05015e717a0d layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Fri Nov 10 13:27:57 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Mon Nov 13 14:48:57 2006 +0000 @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -1576,6 +1577,7 @@ size_t fftSize = getFFTSize(v); if (m_fftModels.find(v) != m_fftModels.end()) { + if (m_fftModels[v].first == 0) return 0; if (m_fftModels[v].first->getHeight() != fftSize / 2) { delete m_fftModels[v].first; m_fftModels.erase(v); @@ -1593,6 +1595,16 @@ true, m_candidateFillStartFrame); + if (!model->isOK()) { + QMessageBox::critical + (0, tr("FFT cache failed"), + tr("Failed to create the FFT model for this spectrogram.\n" + "There may be insufficient memory or disc space to continue.")); + delete model; + m_fftModels[v] = FFTFillPair(0, 0); + return 0; + } + m_fftModels[v] = FFTFillPair(model, 0); model->resume();