Unverified Commit 07a139b7 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #32512 from mantidproject/32498_add_try_catch_to_FunctionTreeView

Add try catch to FunctionTreeView
parents 62d1c959 c1a39ad7
......@@ -32,6 +32,7 @@ Bugfixes
- In frequency domain analysis the phasetables calculated from :ref:`MuonMaxent <algm-MuonMaxent>` can be used for
:ref:`PhaseQuad <algm-PhaseQuad>` calculations on the phase tab.
- A bug has been fixed in ALC that caused mantid to crash when a user changed the PeakPicker in the PeakFitting plot.
- A bug has been fixed in ALC where setting an invalid function would cause a crash.
Muon Analysis
-------------
......
......@@ -1903,22 +1903,28 @@ void FunctionTreeView::attributeChanged(QtProperty *prop) {
// Some attributes require the function to be fully reconstructed, in this
// case we'd need to emit a function replaced signal. If its not one of these
// attributes emit an attributeValueChanged signal.
if (std::find(REQUIRESRECONSTRUCTIONATTRIBUTES.begin(), REQUIRESRECONSTRUCTIONATTRIBUTES.end(),
removePrefix(attributeName)) != REQUIRESRECONSTRUCTIONATTRIBUTES.end()) {
auto funProp = m_properties[prop].parent;
if (!funProp)
return;
auto fun = getFunction(funProp, true);
// delete and recreate all function's properties (attributes, parameters,
// etc)
setFunction(funProp, fun);
updateFunctionIndices();
if (m_emitAttributeValueChange)
emit functionReplaced(QString::fromStdString(getFunction()->asString()));
} else {
if (m_emitAttributeValueChange)
emit attributePropertyChanged(attributeName);
try {
if (std::find(REQUIRESRECONSTRUCTIONATTRIBUTES.begin(), REQUIRESRECONSTRUCTIONATTRIBUTES.end(),
removePrefix(attributeName)) != REQUIRESRECONSTRUCTIONATTRIBUTES.end()) {
auto funProp = m_properties[prop].parent;
if (!funProp)
return;
auto fun = getFunction(funProp, true);
// delete and recreate all function's properties (attributes, parameters,
// etc)
setFunction(funProp, fun);
updateFunctionIndices();
if (m_emitAttributeValueChange) {
emit functionReplaced(QString::fromStdString(getFunction()->asString()));
}
} else {
if (m_emitAttributeValueChange) {
emit attributePropertyChanged(attributeName);
}
}
} catch (std::exception &expt) {
QMessageBox::critical(this, "Mantid - Error", QString::fromStdString(expt.what()));
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment