Mercurial > hg > svcore
comparison transform/FeatureExtractionModelTransformer.cpp @ 1784:4eac4bf35b45
More graceful handling of failure to construct FFT models in the case where the source model has already been deleted before this occurs
author | Chris Cannam |
---|---|
date | Tue, 17 Sep 2019 11:21:33 +0100 |
parents | d484490cdf69 |
children | 5f8fbbde08ff |
comparison
equal
deleted
inserted
replaced
1783:cf3eb6252f42 | 1784:4eac4bf35b45 |
---|---|
641 | 641 |
642 bool ready = false; | 642 bool ready = false; |
643 while (!ready && !m_abandoned) { | 643 while (!ready && !m_abandoned) { |
644 { // scope so as to release input shared_ptr before sleeping | 644 { // scope so as to release input shared_ptr before sleeping |
645 auto input = ModelById::getAs<DenseTimeValueModel>(inputId); | 645 auto input = ModelById::getAs<DenseTimeValueModel>(inputId); |
646 if (!input) { | 646 if (!input || !input->isOK()) { |
647 abandon(); | 647 abandon(); |
648 return; | 648 return; |
649 } | 649 } |
650 ready = input->isReady(); | 650 ready = input->isReady(); |
651 } | 651 } |
715 QString err = model->getError(); | 715 QString err = model->getError(); |
716 delete model; | 716 delete model; |
717 for (int j = 0; in_range_for(m_outputNos, j); ++j) { | 717 for (int j = 0; in_range_for(m_outputNos, j); ++j) { |
718 setCompletion(j, 100); | 718 setCompletion(j, 100); |
719 } | 719 } |
720 //!!! need a better way to handle this -- previously we were using a QMessageBox but that isn't an appropriate thing to do here either | |
721 SVDEBUG << "FeatureExtractionModelTransformer::run: Failed to create FFT model for input model " << inputId << ": " << err << endl; | 720 SVDEBUG << "FeatureExtractionModelTransformer::run: Failed to create FFT model for input model " << inputId << ": " << err << endl; |
722 throw AllocationFailed("Failed to create the FFT model for this feature extraction model transformer: error is: " + err); | 721 m_message = "Failed to create the FFT model for this feature extraction model transformer: error is: " + err; |
722 for (int cch = 0; cch < ch; ++cch) { | |
723 delete fftModels[cch]; | |
724 } | |
725 abandon(); | |
726 return; | |
723 } | 727 } |
724 fftModels.push_back(model); | 728 fftModels.push_back(model); |
725 } | 729 } |
726 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN | 730 #ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN |
727 SVDEBUG << "FeatureExtractionModelTransformer::run: Created FFT model(s) for frequency-domain input" << endl; | 731 SVDEBUG << "FeatureExtractionModelTransformer::run: Created FFT model(s) for frequency-domain input" << endl; |