Ticket #1775 (closed defect: fixed)
view source functionality should be more robust against buggy activities
| Reported by: | rgs | Owned by: | tomeu |
|---|---|---|---|
| Priority: | Unspecified by Maintainer | Milestone: | 0.88 |
| Component: | sugar | Version: | Git as of bugdate |
| Severity: | Major | Keywords: | r+, robust file existence check |
| Cc: | walter | Distribution/OS: | Unspecified |
| Bug Status: | New |
Description
Scenario:
We added view-source support to TurtleArt (see attached code snippet). I manage to hit a code path (a race condition somewhere or problem accessing the temp file) in which I got the following exception (in ~/.sugar/default/logs/shell.log):
File "/usr/lib/python2.6/dist-packages/jarabe/view/viewsource.py", line 291, in __init__ activity_button.props.group = document_button UnboundLocalError: local variable 'document_button' referenced before assignment
Checking the constructor of the Toolbar class in jarabe/view/viewsource.py it seems like the following test:
if document_path is not None:
forgets to check file existence as the previous conditional does:
if document_path is not None and os.path.exists(document_path)
The attached patch proposes a fix by starting document_button to None which seems cheaper then testing for the existence of a file twice.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

