mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +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) {
|
||||
t.Helper()
|
||||
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
|
||||
// operation list. The text input state, wakeup time and whether
|
||||
// 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.wakeup = false
|
||||
for k := range q.profHandlers {
|
||||
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.pointer.queue.Frame(&q.handlers)
|
||||
|
||||
Reference in New Issue
Block a user