diff options
| author | lhchavez <[email protected]> | 2020-12-10 05:35:40 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-10 05:35:40 -0800 |
| commit | e28cce87c7551bffa1f4602ff492348f9a8cba60 (patch) | |
| tree | 17cda66f878bd6285f24d0867c444e9ca2e191e6 /object.go | |
| parent | abf02bc7d79dfb7b0bbcd404ebecb202cff2a18e (diff) | |
Ensure that no pointer handles leak during the test (#712)
This change makes sure that pointer handles are correctly cleaned up
during tests.
Diffstat (limited to 'object.go')
| -rw-r--r-- | object.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -77,14 +77,14 @@ func (o *Object) Type() ObjectType { return ret } -// Owner returns a weak reference to the repository which owns this -// object. This won't keep the underlying repository alive. +// Owner returns a weak reference to the repository which owns this object. +// This won't keep the underlying repository alive, but it should still be +// Freed. func (o *Object) Owner() *Repository { - ret := &Repository{ - ptr: C.git_object_owner(o.ptr), - } + repo := newRepositoryFromC(C.git_object_owner(o.ptr)) runtime.KeepAlive(o) - return ret + repo.weak = true + return repo } func dupObject(obj *Object, kind ObjectType) (*C.git_object, error) { |
