mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
app: ensure derived events are processed
A range loop may not see all items in a slice that is appended to during iteration. Convert range loop to popping each event off the queue until it is empty. Fixes: https://todo.sr.ht/~eliasnaur/gio/356 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-2
@@ -423,10 +423,12 @@ func (c *callbacks) Event(e event.Event) {
|
|||||||
defer func() {
|
defer func() {
|
||||||
c.busy = false
|
c.busy = false
|
||||||
}()
|
}()
|
||||||
for _, e := range c.waitEvents {
|
for len(c.waitEvents) > 0 {
|
||||||
|
e := c.waitEvents[0]
|
||||||
|
copy(c.waitEvents, c.waitEvents[1:])
|
||||||
|
c.waitEvents = c.waitEvents[:len(c.waitEvents)-1]
|
||||||
c.w.processEvent(c.d, e)
|
c.w.processEvent(c.d, e)
|
||||||
}
|
}
|
||||||
c.waitEvents = c.waitEvents[:0]
|
|
||||||
c.w.updateState(c.d)
|
c.w.updateState(c.d)
|
||||||
if c.w.closing {
|
if c.w.closing {
|
||||||
c.w.closing = false
|
c.w.closing = false
|
||||||
|
|||||||
Reference in New Issue
Block a user