mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
io/router: ensure root pointer area in deferred calls
Fixes: https://todo.sr.ht/~eliasnaur/gio/372 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -141,6 +141,11 @@ const (
|
||||
|
||||
func (c *pointerCollector) resetState() {
|
||||
c.state = collectState{}
|
||||
c.nodeStack = c.nodeStack[:0]
|
||||
// Pop every node except the root.
|
||||
if len(c.q.hitTree) > 0 {
|
||||
c.state.nodePlusOne = 0 + 1
|
||||
}
|
||||
}
|
||||
|
||||
func (c *pointerCollector) setTrans(t f32.Affine2D) {
|
||||
@@ -332,7 +337,6 @@ func (c *pointerCollector) offerOp(op transfer.OfferOp, events *handlerEvents) {
|
||||
func (c *pointerCollector) reset() {
|
||||
c.q.reset()
|
||||
c.resetState()
|
||||
c.nodeStack = c.nodeStack[:0]
|
||||
c.ensureRoot()
|
||||
}
|
||||
|
||||
|
||||
@@ -1097,6 +1097,18 @@ func TestTransfer(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestDeferredInputOp(t *testing.T) {
|
||||
var ops op.Ops
|
||||
|
||||
var r Router
|
||||
m := op.Record(&ops)
|
||||
key.InputOp{Tag: new(int)}.Add(&ops)
|
||||
call := m.Stop()
|
||||
|
||||
op.Defer(&ops, call)
|
||||
r.Frame(&ops)
|
||||
}
|
||||
|
||||
// offer satisfies io.ReadCloser for use in data transfers.
|
||||
type offer struct {
|
||||
data string
|
||||
|
||||
Reference in New Issue
Block a user