@@ -18,15 +18,19 @@ type Commit struct {
18
18
cast_ptr * C.git_commit
19
19
}
20
20
21
- func (c Commit ) Message () string {
22
- return C .GoString (C .git_commit_message (c .cast_ptr ))
21
+ func (c * Commit ) Message () string {
22
+ ret := C .GoString (C .git_commit_message (c .cast_ptr ))
23
+ runtime .KeepAlive (c )
24
+ return ret
23
25
}
24
26
25
- func (c Commit ) RawMessage () string {
26
- return C .GoString (C .git_commit_message_raw (c .cast_ptr ))
27
+ func (c * Commit ) RawMessage () string {
28
+ ret := C .GoString (C .git_commit_message_raw (c .cast_ptr ))
29
+ runtime .KeepAlive (c )
30
+ return ret
27
31
}
28
32
29
- func (c Commit ) ExtractSignature () (string , string , error ) {
33
+ func (c * Commit ) ExtractSignature () (string , string , error ) {
30
34
31
35
var c_signed C.git_buf
32
36
defer C .git_buf_free (& c_signed )
@@ -40,7 +44,7 @@ func (c Commit) ExtractSignature() (string, string, error) {
40
44
runtime .LockOSThread ()
41
45
defer runtime .UnlockOSThread ()
42
46
ret := C .git_commit_extract_signature (& c_signature , & c_signed , repo , oid .toC (), nil )
43
-
47
+ runtime . KeepAlive ( oid )
44
48
if ret < 0 {
45
49
return "" , "" , MakeGitError (ret )
46
50
} else {
@@ -49,36 +53,45 @@ func (c Commit) ExtractSignature() (string, string, error) {
49
53
50
54
}
51
55
52
- func (c Commit ) Summary () string {
53
- return C .GoString (C .git_commit_summary (c .cast_ptr ))
56
+ func (c * Commit ) Summary () string {
57
+ ret := C .GoString (C .git_commit_summary (c .cast_ptr ))
58
+ runtime .KeepAlive (c )
59
+ return ret
54
60
}
55
61
56
- func (c Commit ) Tree () (* Tree , error ) {
62
+ func (c * Commit ) Tree () (* Tree , error ) {
57
63
var ptr * C.git_tree
58
64
59
65
runtime .LockOSThread ()
60
66
defer runtime .UnlockOSThread ()
61
67
62
68
err := C .git_commit_tree (& ptr , c .cast_ptr )
69
+ runtime .KeepAlive (c )
63
70
if err < 0 {
64
71
return nil , MakeGitError (err )
65
72
}
66
73
67
74
return allocTree (ptr , c .repo ), nil
68
75
}
69
76
70
- func (c Commit ) TreeId () * Oid {
71
- return newOidFromC (C .git_commit_tree_id (c .cast_ptr ))
77
+ func (c * Commit ) TreeId () * Oid {
78
+ ret := newOidFromC (C .git_commit_tree_id (c .cast_ptr ))
79
+ runtime .KeepAlive (c )
80
+ return c
72
81
}
73
82
74
- func (c Commit ) Author () * Signature {
83
+ func (c * Commit ) Author () * Signature {
75
84
cast_ptr := C .git_commit_author (c .cast_ptr )
76
- return newSignatureFromC (cast_ptr )
85
+ ret := newSignatureFromC (cast_ptr )
86
+ runtime .KeepAlive (c )
87
+ return ret
77
88
}
78
89
79
- func (c Commit ) Committer () * Signature {
90
+ func (c * Commit ) Committer () * Signature {
80
91
cast_ptr := C .git_commit_committer (c .cast_ptr )
81
- return newSignatureFromC (cast_ptr )
92
+ ret := newSignatureFromC (cast_ptr )
93
+ runtime .KeepAlive (c )
94
+ return ret
82
95
}
83
96
84
97
func (c * Commit ) Parent (n uint ) * Commit {
0 commit comments