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

Remote refcount fix #404

Merged
merged 6 commits into from
Aug 26, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Ensure self handle stays alive - keeping it in callbacks is not enough.
  • Loading branch information
mduggan committed Aug 25, 2014
commit 2f2d4005c70eac2aefe66db19a0f7004ac765cbf
10 changes: 8 additions & 2 deletions pygit2/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,15 @@ def fetch(self, signature=None, message=None):
callbacks.transfer_progress = self._transfer_progress_cb
callbacks.update_tips = self._update_tips_cb
callbacks.credentials = self._credentials_cb
callbacks.payload = ffi.new_handle(self)
# We need to make sure that this handle stays alive
self._self_handle = ffi.new_handle(self)
callbacks.payload = self._self_handle

err = C.git_remote_set_callbacks(self._remote, callbacks)
check_error(err)
try:
check_error(err)
finally:
self._self_handle = None

if signature:
ptr = signature._pointer[:]
Expand All @@ -223,6 +228,7 @@ def fetch(self, signature=None, message=None):
check_error(err)
finally:
# Even on error, clear stored callbacks and reset to default
self._self_handle = None
err = C.git_remote_set_callbacks(self._remote, defaultcallbacks)
check_error(err)

Expand Down