mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-08 10:55:35 +00:00
io/router: don't panic for nil op.Ops arguements to Router.Frame
Fixes gio#306 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -220,6 +220,11 @@ func TestKeyFocusedInvisible(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNoOps(t *testing.T) {
|
||||||
|
r := new(Router)
|
||||||
|
r.Frame(nil)
|
||||||
|
}
|
||||||
|
|
||||||
func assertKeyEvent(t *testing.T, events []event.Event, expected bool, expectedInputs ...event.Event) {
|
func assertKeyEvent(t *testing.T, events []event.Event, expected bool, expectedInputs ...event.Event) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
var evtFocus int
|
var evtFocus int
|
||||||
|
|||||||
+6
-2
@@ -68,13 +68,17 @@ func (q *Router) Events(k event.Tag) []event.Event {
|
|||||||
// Frame replaces the declared handlers from the supplied
|
// Frame replaces the declared handlers from the supplied
|
||||||
// operation list. The text input state, wakeup time and whether
|
// operation list. The text input state, wakeup time and whether
|
||||||
// there are active profile handlers is also saved.
|
// there are active profile handlers is also saved.
|
||||||
func (q *Router) Frame(ops *op.Ops) {
|
func (q *Router) Frame(frame *op.Ops) {
|
||||||
q.handlers.Clear()
|
q.handlers.Clear()
|
||||||
q.wakeup = false
|
q.wakeup = false
|
||||||
for k := range q.profHandlers {
|
for k := range q.profHandlers {
|
||||||
delete(q.profHandlers, k)
|
delete(q.profHandlers, k)
|
||||||
}
|
}
|
||||||
q.reader.Reset(&ops.Internal)
|
var ops *ops.Ops
|
||||||
|
if frame != nil {
|
||||||
|
ops = &frame.Internal
|
||||||
|
}
|
||||||
|
q.reader.Reset(ops)
|
||||||
q.collect()
|
q.collect()
|
||||||
|
|
||||||
q.pointer.queue.Frame(&q.handlers)
|
q.pointer.queue.Frame(&q.handlers)
|
||||||
|
|||||||
Reference in New Issue
Block a user