Merge lp://staging/~sinzui/bzr-gtk/precise-commit-0 into lp://staging/bzr-gtk

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 770
Proposed branch: lp://staging/~sinzui/bzr-gtk/precise-commit-0
Merge into: lp://staging/bzr-gtk
Diff against target: 71 lines (+41/-0)
2 files modified
commit.py (+1/-0)
tests/test_commit.py (+40/-0)
To merge this branch: bzr merge lp://staging/~sinzui/bzr-gtk/precise-commit-0
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+89586@code.staging.launchpad.net

Commit message

Define _last_selected_file in init so that async signal callbacks can use it.

Description of the change

I occasionally see the following traceback when committing use bzr-gtk
r769 on precise:

  File "/home/curtis/.bazaar/plugins/gtk/commit.py", line 579, in _on_treeview_files_cursor_changed
    self._update_per_file_info(selection)
  File "/home/curtis/.bazaar/plugins/gtk/commit.py", line 618, in _update_per_file_info
    self._save_current_file_message()
  File "/home/curtis/.bazaar/plugins/gtk/commit.py", line 605, in _save_current_file_message
    if self._last_selected_file is None:
AttributeError: 'CommitDialog' object has no attribute '_last_selected_file'

The commit is successful. Looking at the order of events,
_construct_file_list() connects _on_treeview_files_cursor_changed() to
the cursor-changed signal. _on_treeview_files_cursor_changed() presumes
_last_selected_file() was created, but it will not be created until
_fill_in_per_file_info() is called (which is two lines before
_construct_file_list())

The cursor-changed signal may have been called after _fill_in_per_file_info(),
but it is often called before with Gtk3.

--------------------------------------------------------------------

RULES

    * Ensure that CommitDialog._last_selected_file is defined before
      any signal callback is connected.

QA

While I do know the steps that I see the error, I do not always see it. Maybe
the issue only happens when there is a large tree of changes?
    * Run gcommit under precice
    * Type a few characters
    * Cancel the action
    * Save the message
    * Verify there is no AttributeError on strout

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks for adding tests, bzr-gtk has far too few. :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: