forked from joejulian/gio
app/internal/window: use defer for cleanup function
Avoids a vet warning about unreachable code: currently, the cleanup function is never reached. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -69,12 +69,12 @@ func NewWindow(win Callbacks, opts *Options) error {
|
|||||||
w.addHistory()
|
w.addHistory()
|
||||||
w.w = win
|
w.w = win
|
||||||
go func() {
|
go func() {
|
||||||
|
defer w.cleanup()
|
||||||
w.w.SetDriver(w)
|
w.w.SetDriver(w)
|
||||||
w.blur()
|
w.blur()
|
||||||
w.w.Event(system.StageEvent{Stage: system.StageRunning})
|
w.w.Event(system.StageEvent{Stage: system.StageRunning})
|
||||||
w.draw(true)
|
w.draw(true)
|
||||||
select {}
|
select {}
|
||||||
w.cleanup()
|
|
||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -398,7 +398,7 @@ func (w *window) addEventListener(this js.Value, event string, f func(this js.Va
|
|||||||
}
|
}
|
||||||
|
|
||||||
// funcOf is like js.FuncOf but adds the js.Func to a list of
|
// funcOf is like js.FuncOf but adds the js.Func to a list of
|
||||||
// functions to be released up.
|
// functions to be released during cleanup.
|
||||||
func (w *window) funcOf(f func(this js.Value, args []js.Value) interface{}) js.Func {
|
func (w *window) funcOf(f func(this js.Value, args []js.Value) interface{}) js.Func {
|
||||||
jsf := js.FuncOf(f)
|
jsf := js.FuncOf(f)
|
||||||
w.cleanfuncs = append(w.cleanfuncs, jsf.Release)
|
w.cleanfuncs = append(w.cleanfuncs, jsf.Release)
|
||||||
|
|||||||
Reference in New Issue
Block a user