Skip to content

Commit de73d53

Browse files
committed
Release all in plotter update after error
1 parent 3caf80d commit de73d53

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

psyplot/plotter.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ def update_the_others():
13881388
# get the formatoptions. We sort them here by key to make sure that
13891389
# the order always stays the same (easier for debugging)
13901390
fmtos = sorted(self._set_and_filter(), key=lambda fmto: fmto.key)
1391-
except:
1391+
except Exception:
13921392
# restore last (working) state
13931393
last_state = self._old_fmt.pop(-1)
13941394
with self.no_validation:
@@ -1422,19 +1422,24 @@ def update_the_others():
14221422
return True
14231423
# otherwise we update it
14241424
arr_draw = False
1425-
for priority, grouper in fmto_groups:
1426-
arr_draw = True
1427-
self._plot_by_priority(priority, grouper)
1428-
update_the_others()
1425+
try:
1426+
for priority, grouper in fmto_groups:
1427+
arr_draw = True
1428+
self._plot_by_priority(priority, grouper)
1429+
update_the_others()
1430+
except Exception:
1431+
raise
1432+
finally:
1433+
# make sure that all locks are released
1434+
self._release_all(finish=True,
1435+
queue=None if queues is None else queues[1])
14291436
if draw is None:
14301437
draw = rcParams['auto_draw']
14311438
if draw and arr_draw:
14321439
self.draw()
14331440
if rcParams['auto_show']:
14341441
self.show()
14351442
self.replot = False
1436-
# make sure that all locks are released
1437-
self._release_all(True, queue=None if queues is None else queues[1])
14381443
return arr_draw
14391444

14401445
def _release_all(self, finish=False, queue=None):

0 commit comments

Comments
 (0)