summaryrefslogtreecommitdiff
path: root/commit.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-05-26 09:28:07 +0200
committerCarlos Martín Nieto <[email protected]>2014-05-26 09:28:07 +0200
commit8a73c75f1a68f2855d03e6d2ce45c95c414aa71a (patch)
tree967dae543c50f926ad728be38ffeaa3fefda7147 /commit.go
parentf953d4e5c7c676cd3b3ee797fedce8823b5c930c (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.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/commit.go b/commit.go
index 0a5cfce..ed026a4 100644
--- a/commit.go
+++ b/commit.go
@@ -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 {