SasView / sasview

Code for the SasView application.
BSD 3-Clause "New" or "Revised" License
51 stars 41 forks source link

Deletting a dataset is not possible after closing a plot #2527

Closed lozanodorian closed 1 year ago

lozanodorian commented 1 year ago

Describe the bug Probably linked to the precedent issue #2526. A dataset cannot be deleted from the Data Explorer Pannel once any of the following windows has been closed :

An example of error message (here, model plot and residuals are closed and the sphere_80.txt dataset is chosen) :

14:21:27 - sas.qtgui.Perspectives.Fitting.FittingWidget - ERROR - Traceback (most recent call last):
  File "sasview/src/sas/qtgui/MainWindow/DataExplorer.py", line 1804, in deleteSelectedItem
    self.deleteIndices(indices)
  File "sasview/src/sas/qtgui/MainWindow/DataExplorer.py", line 1830, in deleteIndices
    self.closePlotsForItem(item_to_delete)
  File "sasview/src/sas/qtgui/MainWindow/DataExplorer.py", line 1898, in closePlotsForItem
    plotter.close()
RuntimeError: Internal C++ object (Plotter) already deleted.

Sometimes a second message is printed:

qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 3564, resource id: 19791090, major code: 40 (TranslateCoords), minor code: 0

To Reproduce Steps to reproduce the behavior:

  1. Load one (1D or 2D) dataset
  2. Send data to Fitting
  3. Choose a model (Category and name)
  4. Click on the Compute/Plot button
  5. Close one or several window(s) (model, residuals...)
  6. Right-click on the dataset selected in (1.) in the Data Explorer > Data menu and click on Delete
  7. Confirm with the Yes button
  8. See problem : dataset is still present in the menu. The first error message above appears in the terminal.

Note : close a chisquare window after using the Fit button instead of the Compute/Plot button doesn't cause the bug. In that case, we observe the expected behaviour, but an error message appears (several times) in the terminal...

 14:48:08 - sas.qtgui.Perspectives.Fitting.FittingWidget - ERROR - Traceback (most recent call last):
  File "sasview/src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py", line 279, in model_changed
    self.slider.extrapolation_parameters = self.extrapolation_parmameters
  File "sasview/src/sas/qtgui/Perspectives/Corfunc/CorfuncSlider.py", line 221, in extrapolation_parameters
    if self.find_parameter_problems(params) is None:
  File "sasview/src/sas/qtgui/Perspectives/Corfunc/CorfuncSlider.py", line 84, in find_parameter_problems
    if params.data_q_min >= params.point_1:
AttributeError: 'NoneType' object has no attribute 'data_q_min'

...and sometimes the following message also appears :

qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 2869, resource id: 20034507, major code: 40 (TranslateCoords), minor code: 0

Expected behavior The dataset should disappear from Data Explorer > Data menu, with all the plots linked to it.

SasView version:

Operating system:

rozyczko commented 1 year ago

Same reason as #2526

It seems there is an event filter somewhere, which prohibits custom QtWidget.closeEvent() from being called on widget close. This is NOT a Pyside6 issue. The custom slot is never called so the plot accounting does not work and dragons abound.