diff --git a/docs/source/release/v6.9.1/index.rst b/docs/source/release/v6.9.1/index.rst index bee08622220a..e0fc0a8c8171 100644 --- a/docs/source/release/v6.9.1/index.rst +++ b/docs/source/release/v6.9.1/index.rst @@ -15,6 +15,7 @@ The changes are: - Removed slit lookup that was specific to OFFSPEC in :ref:`algm-ReflectometryReductionOneLiveData` as it is no longer required and was causing regular crashes when running live data on OFFSPEC. - Fixed a bug in :ref:`Elwin Tab ` of :ref:`Data Manipulation Interface ` where changing integration range with the sliders did not change default integration range. - Add sample log values to the live data workspace before the instrument is loaded in :ref:`algm-ReflectometryReductionOneLiveData` to ensure log values are available when setting the detector positions. + - Fixed a crash when using multiple Indirect or Inelastic interfaces. This crash was present on the :ref:`Bayes Fitting ` interface, but could also be replicated elsewhere. Citation -------- @@ -36,6 +37,7 @@ Changes in this version * `37053 `_ Load instrument after loading sample logs in ReflectometryReductionOneLiveData * `37016 `_ Fix sliders not changing integration limits in Elwin tab * `36935 `_ Fix regular live data crashes on OFFSPEC +* `37074 `_ Fix crash on Indirect/Inelastic interfaces. .. _download page: http://download.mantidproject.org diff --git a/qt/widgets/plotting/src/PreviewPlot.cpp b/qt/widgets/plotting/src/PreviewPlot.cpp index 99d54d5bb9e6..230e7d240662 100644 --- a/qt/widgets/plotting/src/PreviewPlot.cpp +++ b/qt/widgets/plotting/src/PreviewPlot.cpp @@ -43,6 +43,16 @@ constexpr auto LOG_SCALE = "Log"; constexpr auto SQUARE_SCALE = "Square"; constexpr auto SHOWALLERRORS = "Show all errors"; constexpr auto HIDEALLERRORS = "Hide all errors"; + +template void modifyObserver(Observer &observer, bool const turnOn) { + auto ¬ificationCenter = AnalysisDataService::Instance().notificationCenter; + if (turnOn && !notificationCenter.hasObserver(observer)) { + notificationCenter.addObserver(observer); + } else if (!turnOn && notificationCenter.hasObserver(observer)) { + notificationCenter.removeObserver(observer); + } +} + } // namespace namespace MantidQt::MantidWidgets { @@ -77,14 +87,8 @@ PreviewPlot::~PreviewPlot() { watchADS(false); } * @param on If true ADS observers are enabled else they are disabled */ void PreviewPlot::watchADS(bool on) { - auto ¬ificationCenter = AnalysisDataService::Instance().notificationCenter; - if (on) { - notificationCenter.addObserver(m_wsRemovedObserver); - notificationCenter.addObserver(m_wsReplacedObserver); - } else { - notificationCenter.removeObserver(m_wsReplacedObserver); - notificationCenter.removeObserver(m_wsRemovedObserver); - } + modifyObserver(m_wsReplacedObserver, on); + modifyObserver(m_wsRemovedObserver, on); } /**