From 8a73c75f1a68f2855d03e6d2ce45c95c414aa71a Mon Sep 17 00:00:00 2001 From: Carlos Martín Nieto Date: Mon, 26 May 2014 09:28:07 +0200 Subject: 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. --- commit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'commit.go') 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 { -- cgit v1.2.3