Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion event/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (bus *Bus) trigger(binds bindableList, eventID UnsafeEventID, callerID Call
// A: This goroutine does not own a write lock on the bus, and should therefore
// not modify its contents. We do not have a simple way of promoting our read lock
// to a write lock.
bus.Unbind(Binding{EventID: eventID, CallerID: callerID, BindID: bindID})
bus.Unbind(Binding{EventID: eventID, CallerID: callerID, BindID: bindID, busResetCount: bus.resetCount})
case ResponseUnbindThisCaller:
bus.UnbindAllFrom(callerID)
}
Expand Down
3 changes: 3 additions & 0 deletions event/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ func TestBindingResponses(t *testing.T) {
t.Run("UnbindThisBinding", func(t *testing.T) {
b := event.NewBus(event.NewCallerMap())

// bus reset counts are checked against bindings
b.Reset()

var calls int32
b1 := b.UnsafeBind(1, 0, func(ci event.CallerID, h event.Handler, i interface{}) event.Response {
atomic.AddInt32(&calls, 1)
Expand Down