Skip to content

Commit

Permalink
browse: handle object deletion when paths are untracked
Browse files Browse the repository at this point in the history
If an existing path becomes untracked git-cola would try to send a
signal to a dead C++ object and crash:

	RuntimeError: wrapped C/C++ object of type
	              GitRepoNameItem has been deleted
	error: git-cola died of signal 6

Disconnect signals when connecting to the global GitRepoEntry instances
so that no signals are ever delivered to deleted objects.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information
davvid committed Jan 18, 2017
1 parent 1c1a1d1 commit 1198e35
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cola/models/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,11 @@ def __init__(self, column, path, parent, runtask):
self.setEditable(False)
entry = GitRepoEntryStore.entry(path, parent, runtask)
if column == Columns.STATUS:
qtutils.disconnect(entry.status)
entry.status.connect(self.set_status, type=Qt.QueuedConnection)
else:
signal = getattr(entry, column)
qtutils.disconnect(signal)
signal.connect(self.setText, type=Qt.QueuedConnection)

def set_status(self, data):
Expand Down
8 changes: 8 additions & 0 deletions cola/qtutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
SKIPPED = object()


def disconnect(signal):
"""Disconnect signal from all slots"""
try:
signal.disconnect()
except TypeError: # allow unconnected slots
pass


def connect_action(action, fn):
"""Connect an action to a function"""
action.triggered[bool].connect(lambda x: fn())
Expand Down
10 changes: 10 additions & 0 deletions share/doc/git-cola/relnotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ Clone the git-cola repo to get the latest development version:

``git clone git://github.com/git-cola/git-cola.git``

.. _v2.11:

git-cola v2.11 (beta)
=====================

Fixes
=====
* Properly handle the case where an existing file is untracked using
the File Browser.

.. _v2.10:

git-cola v2.10
Expand Down

0 comments on commit 1198e35

Please sign in to comment.