eugenemel / maven

Maven GUI: Metabolomics Analysis and Visualization Engine
https://github.com/eugenemel/maven/releases
GNU General Public License v3.0
19 stars 9 forks source link

Clicking through spectral library with no samples selected can cause program to hang #690

Closed PMSeitzer closed 7 months ago

PMSeitzer commented 7 months ago

Probably related to repeated calls from MassCalculator::getComposition().

PMSeitzer commented 7 months ago

This has to do with very expensive computations performed for some molecular formulas in the isotopes widget, probably from refactor in #656

PMSeitzer commented 7 months ago

Simplest way might be to try and respect some of the IsotopeParameters in the MassCalculator::getNaturalAbundanceDistribution() call. Also possible to do some caching here

PMSeitzer commented 7 months ago

As a part of this work, remove oldMassCalculator::computeIsotopes(), which was deprecated with the introduction of MassCalculator::computeIsotopes2().

PMSeitzer commented 7 months ago

There was some old pullIsotopes stubs in peakdetector, which probably have not been used for a few years now

PMSeitzer commented 7 months ago

Upon deeper investigation, it appears that MassCalculator::getComposition() might be hanging on formic acid adducts.

PMSeitzer commented 7 months ago

The culprit turned out to be an infinite loop where the selected index of a combo box was manually changed, firing a signal, which triggered a new event, which caused the index to change, which fired a signal, etc.

Simple solution is to block unwanted signals from manual index update: f45d7933f3f524d76d1d6875fc9472c90c8605bb