mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
210 stars 122 forks source link

Crash if delete all batch tabs or add a new batch tab in ISIS Reflectometry GUI #36332

Closed rbauststfc closed 10 months ago

rbauststfc commented 11 months ago

Describe the bug

Deleting all of the batch tabs from the ISIS Reflectometry GUI causes Mantid to crash. Also occurs if just adding a new batch tab.

To Reproduce

1) Go to Interfaces -> Reflectometry -> ISIS Reflectometry 2) Delete all of the batch tabs in the GUI. Mantid will crash.

or

1) Go to Interfaces -> Reflectometry -> ISIS Reflectometry 2) Add a new batch tab in the GUI. Mantid will crash.

Expected behavior

The previous behaviour was that a new batch would be created with the next number in the sequence, for both ways of reproducing the error.

We should add a section to the manual testing instructions to check for this bug as I think it's probably quite easy to introduce. Our users have confirmed that deleting all the batch tabs is not something they ever actually do, but adding new batches is more concerning.

Platform/Version (please complete the following information):

rbauststfc commented 10 months ago

This still needs further investigation, but below is the error and stack trace from the exception that's thrown on adding a new batch tab. On an up to date branch off main, I tested reverting the Python 3.10 changes and it seemed to resolve the problem. I noticed this commit in the PR for the version update that was required because there were some changes in Python 3.10 to do with interaction with the GIL - I don't know if this issue could also be along similar lines/in some way related to the GIL.

The code path that throws the exception is used when the dialog first opens to add two batch tabs by default. At this point everything completes without an error. It's only after this, when the same code path is used to add additional batch tabs, that the problem arises.

Exception thrown at 0x00007FFFDEEA18ED (python310.dll) in python.exe: 0xC0000005: Access violation reading location

[Inline Frame] python310.dll!_PyInterpreterState_GET() Line 117 C python310.dll!_PyUnicode_FromId(_Py_Identifier id) Line 2338 C [Inline Frame] python310.dll!_PyType_LookupId(_typeobject ) Line 3861 C python310.dll!slot_tp_getattr_hook(_object self, _object name) Line 7552 C python310.dll!PyObject_GetAttr(_object v, _object name) Line 933 C python310.dll!PyObject_GetAttrString(_object v, const char name) Line 816 C [External Code]

MantidQtWidgetsMplCppQt5.dll!boost::python::api::const_attribute_policies::get(const boost::python::api::object & target, const char key) Line 74 C++ MantidQtWidgetsMplCppQt5.dll!boost::python::api::proxy::operator boost::python::api::object() Line 60 C++ MantidQtWidgetsMplCppQt5.dll!boost::python::api::object_initializer_impl<1,0>::get(const boost::python::api::proxy & x, std::integral_constant<bool,0> __formal) Line 300 C++ MantidQtWidgetsMplCppQt5.dll!boost::python::api::object_base_initializer<boost::python::api::proxy>(const boost::python::api::proxy & x) Line 236 C++ MantidQtWidgetsMplCppQt5.dll!boost::python::api::object::object<boost::python::api::proxy>(const boost::python::api::proxy & x) Line 247 C++ MantidQtWidgetsMplCppQt5.dll!MantidQt::Widgets::MplCpp::FigureCanvasQt::FigureCanvasQt(const int subplotspec, const QString & projection, QWidget parent) Line 76 C++ MantidQtWidgetsPlottingQt5.dll!MantidQt::MantidWidgets::QtPlotView::QtPlotView(QWidget parent) Line 20 C++ MantidScientificInterfacesISISReflectometryQt5.dll!Ui_PreviewDockedWidgets::setupUi(QMainWindow PreviewDockedWidgets) Line 176 C++ MantidScientificInterfacesISISReflectometryQt5.dll!MantidQt::CustomInterfaces::ISISReflectometry::QtPreviewDockedWidgets::QtPreviewDockedWidgets(QWidget parent, QLayout layout) Line 30 C++ [External Code] MantidScientificInterfacesISISReflectometryQt5.dll!MantidQt::CustomInterfaces::ISISReflectometry::PreviewPresenter::PreviewPresenter(MantidQt::CustomInterfaces::ISISReflectometry::PreviewPresenter::Dependencies dependencies) Line 43 C++ [External Code] MantidScientificInterfacesISISReflectometryQt5.dll!MantidQt::CustomInterfaces::ISISReflectometry::PreviewPresenterFactory::make(MantidQt::CustomInterfaces::ISISReflectometry::IPreviewView view, std::unique_ptr<MantidQt::CustomInterfaces::ISISReflectometry::IReflAlgorithmFactory,std::default_delete> algFactory) Line 30 C++ MantidScientificInterfacesISISReflectometryQt5.dll!MantidQt::CustomInterfaces::ISISReflectometry::BatchPresenterFactory::make(MantidQt::CustomInterfaces::ISISReflectometry::IBatchView view) Line 54 C++ MantidScientificInterfacesISISReflectometryQt5.dll!MantidQt::CustomInterfaces::ISISReflectometry::MainWindowPresenter::addNewBatch(MantidQt::CustomInterfaces::ISISReflectometry::IBatchView * batchView) Line 265 C++ MantidScientificInterfacesISISReflectometryQt5.dll!MantidQt::CustomInterfaces::ISISReflectometry::MainWindowPresenter::notifyNewBatchRequested() Line 73 C++ MantidScientificInterfacesISISReflectometryQt5.dll!MantidQt::CustomInterfaces::ISISReflectometry::QtMainWindowView::onNewBatchRequested(bool __formal) Line 127 C++