fix(scope): disable cgo finalizers after manual cleanup
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
446a02fad9
commit
0aeba0a5db
2 changed files with 2 additions and 0 deletions
|
|
@ -71,6 +71,7 @@ func (b *Buffer) Free() {
|
|||
panic("cgo.Buffer.Free: double-free detected")
|
||||
}
|
||||
|
||||
runtime.SetFinalizer(b, nil)
|
||||
C.free(b.pointer)
|
||||
b.pointer = nil
|
||||
b.data = nil
|
||||
|
|
|
|||
1
scope.go
1
scope.go
|
|
@ -81,6 +81,7 @@ func (s *Scope) FreeAll() {
|
|||
if !s.freed.CompareAndSwap(false, true) {
|
||||
panic("cgo.Scope.FreeAll: double-free detected")
|
||||
}
|
||||
runtime.SetFinalizer(s, nil)
|
||||
|
||||
s.lock.Lock()
|
||||
buffers := s.buffers
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue