This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch main
in repository ego.
View the commit online.
commit eac622aa6af45fdec2333bec78b171170e9bea68
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 9 15:16:30 2026 -0600
refactor: rename Handle.Disconnect to Handle.Close for Go idiom compatibility
Rename the Handle.Disconnect method to Handle.Close to align with Go's
io.Closer pattern, which provides a standard interface for resources that
need cleanup. This improves API familiarity for Go developers and enables
use of Handle with standard library patterns expecting Closer.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
efl/event.go | 16 ++++++++--------
efl/event_test.go | 24 ++++++++++++------------
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/efl/event.go b/efl/event.go
index 4993bcd..0552ad3 100644
--- a/efl/event.go
+++ b/efl/event.go
@@ -57,8 +57,8 @@ var (
cbSeq atomic.Uintptr
)
-// Handle represents a registered EFL event callback. Call Disconnect to remove
-// the callback and release all associated resources. A zero Handle is invalid.
+// Handle represents a registered EFL event callback. Call Close to remove the
+// callback and release all associated resources. A zero Handle is invalid.
type Handle struct {
obj unsafe.Pointer // Eo* the callback is registered on
desc unsafe.Pointer // Efl_Event_Description* for the event
@@ -85,10 +85,10 @@ func RegisterCallback(obj unsafe.Pointer, desc unsafe.Pointer, fn func(eventInfo
return Handle{obj: obj, desc: desc, id: id}
}
-// Disconnect removes the callback from the EFL object and deletes the Go-side
-// map entry. Must be called on the EFL thread. Calling Disconnect on a zero or
-// already-disconnected Handle is a no-op.
-func (h *Handle) Disconnect() {
+// Close removes the callback from the EFL object and deletes the Go-side map
+// entry. Must be called on the EFL thread. Calling Close on a zero or
+// already-closed Handle is a no-op.
+func (h *Handle) Close() {
if h == nil || h.id == 0 {
return
}
@@ -119,9 +119,9 @@ func ClearCallbacks(obj unsafe.Pointer) {
return
}
// Collect the IDs to remove under the write lock so no dispatch can race
- // with the deletion. Unlike Disconnect (which calls C before locking),
+ // with the deletion. Unlike Close (which calls C before locking),
// ClearCallbacks holds the lock across the C calls to prevent a concurrent
- // Disconnect on the same IDs from double-deleting. Both orderings are safe
+ // Close on the same IDs from double-deleting. Both orderings are safe
// because the EFL-thread contract makes concurrent execution impossible.
cbMu.Lock()
var toRemove []uintptr
diff --git a/efl/event_test.go b/efl/event_test.go
index cc2cf11..4f4eac4 100644
--- a/efl/event_test.go
+++ b/efl/event_test.go
@@ -45,9 +45,9 @@ func TestRegisterCallback(t *testing.T) {
}
}
-// TestDisconnect verifies that a disconnected callback is NOT invoked when the
-// object is subsequently deleted.
-func TestDisconnect(t *testing.T) {
+// TestClose verifies that a closed callback is NOT invoked when the object is
+// subsequently deleted.
+func TestClose(t *testing.T) {
var called atomic.Int32
efl.Sync(func() {
@@ -57,28 +57,28 @@ func TestDisconnect(t *testing.T) {
called.Add(1)
})
- // Disconnect before the object is deleted.
- h.Disconnect()
+ // Close before the object is deleted.
+ h.Close()
- // Deleting the object must NOT fire the disconnected callback.
+ // Deleting the object must NOT fire the closed callback.
efl.DelEoObject(raw)
})
if n := called.Load(); n != 0 {
- t.Fatalf("disconnected callback called %d time(s), want 0", n)
+ t.Fatalf("closed callback called %d time(s), want 0", n)
}
}
-// TestDisconnectIdempotent verifies that calling Disconnect more than once on
-// the same Handle does not panic or otherwise misbehave.
-func TestDisconnectIdempotent(t *testing.T) {
+// TestCloseIdempotent verifies that calling Close more than once on the same
+// Handle does not panic or otherwise misbehave.
+func TestCloseIdempotent(t *testing.T) {
efl.Sync(func() {
raw := newTestObject(t)
h := efl.RegisterCallback(raw, efl.EFLEventDelDesc(), func(_ unsafe.Pointer) {})
- h.Disconnect()
- h.Disconnect() // must not panic or double-free
+ h.Close()
+ h.Close() // must not panic or double-free
efl.DelEoObject(raw)
})
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.