diff options
| author | Carlos Martín Nieto <[email protected]> | 2014-05-26 09:28:07 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2014-05-26 09:28:07 +0200 |
| commit | 8a73c75f1a68f2855d03e6d2ce45c95c414aa71a (patch) | |
| tree | 967dae543c50f926ad728be38ffeaa3fefda7147 /commit.go | |
| parent | f953d4e5c7c676cd3b3ee797fedce8823b5c930c (diff) | |
Keep a pointer to the repository in the objects and references
Otherwise, the garbage collector might decide it's a good idea to throw
away the repository instance while the C object still has a pointer to
it. Hilarity ensues.
Diffstat (limited to 'commit.go')
| -rw-r--r-- | commit.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -35,7 +35,7 @@ func (c Commit) Tree() (*Tree, error) { return nil, MakeGitError(err) } - return allocObject((*C.git_object)(ptr)).(*Tree), nil + return allocObject((*C.git_object)(ptr), c.repo).(*Tree), nil } func (c Commit) TreeId() *Oid { @@ -59,7 +59,7 @@ func (c *Commit) Parent(n uint) *Commit { return nil } - return allocObject((*C.git_object)(cobj)).(*Commit) + return allocObject((*C.git_object)(cobj), c.repo).(*Commit) } func (c *Commit) ParentId(n uint) *Oid { |
