SasView / sasview

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

Replotting is not possible after closing a plot #2526

Closed lozanodorian closed 1 year ago

lozanodorian commented 1 year ago

Describe the bug Once their window has been closed, residuals and model plots cannot be plotted again.

One example of error message (here, the main model plot is the only window closed and the sphere_80.txt dataset is chosen) :

13:12:39 - sas.qtgui.Perspectives.Fitting.FittingWidget - ERROR - Traceback (most recent call last):
  File "sasview/src/sas/qtgui/MainWindow/GuiManager.py", line 1303, in showPlot
    self.filesWidget.displayData(plot, id)
  File "sasview/src/sas/qtgui/MainWindow/DataExplorer.py", line 1083, in displayData
    shown = self.updatePlot(plot_to_show)
  File "sasview/src/sas/qtgui/MainWindow/DataExplorer.py", line 1271, in updatePlot
    self.active_plots[data_id].replacePlot(data_id, data)
  File "sasview/src/sas/qtgui/Plotting/Plotter.py", line 618, in replacePlot
    self.removePlot(id)
  File "sasview/src/sas/qtgui/Plotting/Plotter.py", line 658, in removePlot
    self.plot(data=self.plot_dict[ids], hide_error=self.plot_dict[ids].hide_error)
  File "sasview/src/sas/qtgui/Plotting/Plotter.py", line 138, in plot
    self.properties = ScaleProperties(self,
  File "sasview/src/sas/qtgui/Plotting/ScaleProperties.py", line 24, in __init__
    super(ScaleProperties, self).__init__(parent)
RuntimeError: Internal C++ object (Plotter) already deleted.

13:12:39 - sas.qtgui.Perspectives.Fitting.FittingWidget - ERROR - Traceback (most recent call last):
  File "sasview/src/sas/qtgui/MainWindow/DataExplorer.py", line 1271, in updatePlot
    self.active_plots[data_id].replacePlot(data_id, data)
  File "sasview/src/sas/qtgui/Plotting/Plotter.py", line 610, in replacePlot
    selected_plot = self.plot_dict[id]
KeyError: 'M1 [sphere_80.txt]'

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. Click on the Compute/Plot button
  7. See problem : closed windows do not reappear. The error message above appears in the terminal.

Note: If the Fit button is used (with parameters selected for the Fit) instead of the Compute/Plot button for (4.) and (6.), the chi-square window will reappear in (7.), but errors will still be displayed in the terminal for the main plot and residuals if they were closed in (5.).

Expected behavior Closed windows should reappear.

SasView version (please complete the following information):

Operating system:

rozyczko commented 1 year ago

duplicate of #2527