Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Fix crash in listview if labels are changed before calling __setitem__ #1825

Merged
merged 1 commit into from
Jan 3, 2017

Conversation

janezd
Copy link
Contributor

@janezd janezd commented Dec 16, 2016

Issue

Confusion matrix, and possibly other widgets, may change the items in the listview before triggering ControlledList.__setitem__. __setitem__ already took care about this by checking whether self.listbox(item) returned None. This apparently doesn't always work since one user got

        Traceback (most recent call last) 
          File "E:\\ORANGE\\Python34\\lib\\site-packages\\Orange\\canvas\\scheme\\widgetsscheme.py", line 822, in process_signals_for_widget
            handler(*args)
          File "E:\\ORANGE\\Python34\\lib\\site-packages\\Orange\\widgets\\evaluate\\owconfusionmatrix.py", line 270, in set_results
            self.selected_learner[:] = prev_sel_learner
          File "E:\\ORANGE\\Python34\\lib\\site-packages\\Orange\\widgets\\gui.py", line 2062, in __setitem__
            unselect(i)
          File "E:\\ORANGE\\Python34\\lib\\site-packages\\Orange\\widgets\\gui.py", line 2050, in unselect
            item = self.listBox.item(i)
        RuntimeError: wrapped C/C++ object of type OrangeListBox has been deleted
Description of changes

Besides checking for None, the method now also catches the exception.

Includes
  • Code changes

item = self.listBox.item(i)
try:
item = self.listBox.item(i)
except RunTimeError: # Underlying C/C++ object has been deleted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably hard to test, since we don't know how to reproduce the error, right?
I am guessing RunTimeError is a typo of RuntimeError.

@janezd
Copy link
Contributor Author

janezd commented Dec 23, 2016

I changed RunTimeError to RuntimeError (apparently Python notices this only when trying to handle the exception).

I tried to reproduce the error with a test, but haven't gotten anywhere, so --- no tests. This happens in ControlledList, which we use in list views that do not use models. IMHO, we should migrate all list views to models anyway.

@codecov-io
Copy link

codecov-io commented Dec 23, 2016

Current coverage is 89.20% (diff: 100%)

Merging #1825 into master will not change coverage

@@             master      #1825   diff @@
==========================================
  Files            86         86          
  Lines          9077       9077          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           8097       8097          
  Misses          980        980          
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 75125ad...44565e3

@lanzagar lanzagar merged commit 3ca9708 into biolab:master Jan 3, 2017
astaric pushed a commit to astaric/orange3 that referenced this pull request Jan 4, 2017
[FIX] Fix crash in listview if labels are changed before calling __setitem__
astaric pushed a commit to astaric/orange3 that referenced this pull request Jan 4, 2017
[FIX] Fix crash in listview if labels are changed before calling __setitem__
astaric pushed a commit to astaric/orange3 that referenced this pull request Jan 4, 2017
[FIX] Fix crash in listview if labels are changed before calling __setitem__
@astaric astaric modified the milestone: 3.3.10 Jan 4, 2017
astaric pushed a commit to astaric/orange3 that referenced this pull request Jan 6, 2017
[FIX] Fix crash in listview if labels are changed before calling __setitem__
(cherry picked from commit 3ca9708)
astaric pushed a commit to astaric/orange3 that referenced this pull request Jan 10, 2017
[FIX] Fix crash in listview if labels are changed before calling __setitem__
(cherry picked from commit 3ca9708)
astaric pushed a commit to astaric/orange3 that referenced this pull request Jan 11, 2017
[FIX] Fix crash in listview if labels are changed before calling __setitem__
(cherry picked from commit 3ca9708)
astaric pushed a commit to astaric/orange3 that referenced this pull request Jan 13, 2017
[FIX] Fix crash in listview if labels are changed before calling __setitem__
(cherry picked from commit 3ca9708)
astaric pushed a commit to astaric/orange3 that referenced this pull request Jan 18, 2017
[FIX] Fix crash in listview if labels are changed before calling __setitem__
(cherry picked from commit 3ca9708)
@janezd janezd deleted the fix-listview-unselect branch April 5, 2019 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants