M40V / populse_mia

Multiparametric Image Analysis
Other
0 stars 0 forks source link

[CLOSED] Crash when closing a pipeline window #5

Open M40V opened 5 years ago

M40V commented 5 years ago

Issue by JanWP Wednesday Oct 10, 2018 at 11:10 GMT _Originally opened as https://github.com/populse/populse_mia/issues/5_


When closing an empty pipeline via the "close Tab" icon, MIA crashes. This happens whether a project is loaded in the data browser or not, and whether only one or several pipeline tabs are open.

To reproduce:

  1. Start MIA
  2. Go to pipeline manager
  3. [Optional: open one or more additional pipelines with the "+" button]
  4. Click on the round "close tab" icon with the cross for any open pipeline tab.

Error message:

excepthook
clean up done
Traceback (most recent call last):
  File "/my_mia_path/python/populse_mia/src/modules/PipelineManager/PipelineEditor.py", line 189, in close_tab
    del self.undos[filename]
KeyError: '&New Pipeline'

Expected behavior: The tab should close. If the case of zero open pipeline tabs is not intended to be supported, the "close tab" button should be inactive if only one tab is open.

Since I don't know yet how to add a process to the pipeline, I can't check for now if the problem also occurs for non-empty pipelines. EDIT: The problem disappears if the pipeline is not empty.

M40V commented 5 years ago

Comment by JanWP Friday Oct 12, 2018 at 11:25 GMT


The error results, because self.tabText(int) returns a string containing an extra ampersand (e.g. '&New Pipeline' instead of 'New Pipeline' or 'New Pipeline &1' instead of 'New Pipeline 1').

Turns out, this is a problem related to a feature of Qt: the ampersand in tab texts indicates the keyboard shortcut that can be used to switch to that tab. This can be specified when defining the tab text (MIA does not do this), but apparently on my version of Qt, a shortcut is automatically added by Qt. As a result, the string returned by tabText does not correspond to the keys of the undo/redo dictionaries.

This problem for now seems to only affect lookup in the undos/redos dictionary. I think using the PipelineEditor objects as keys, instead of the tab text, would solve this. I'll look into this and will try to propose a pull request in case I succeed.