@@ 89,6 89,9 @@ type Window struct {
}
imeState editorState
driver driver
+ // gpuErr tracks the GPU error that is to be reported when
+ // the window is closed.
+ gpuErr error
// invMu protects mayInvalidate.
invMu sync.Mutex
@@ 227,7 230,8 @@ func (w *Window) processFrame(frame *op.Ops, ack chan<- struct{}) {
w.lastFrame.deco.Add(wrapper)
if err := w.validateAndProcess(w.lastFrame.size, w.lastFrame.sync, wrapper, ack); err != nil {
w.destroyGPU()
- w.driver.ProcessEvent(DestroyEvent{Err: err})
+ w.gpuErr = err
+ w.driver.Perform(system.ActionClose)
return
}
w.updateState()
@@ 637,6 641,9 @@ func (w *Window) processEvent(e event.Event) bool {
e2.Size = e2.Size.Sub(offset)
w.coalesced.frame = &e2
case DestroyEvent:
+ if w.gpuErr != nil {
+ e2.Err = w.gpuErr
+ }
w.destroyGPU()
w.invMu.Lock()
w.mayInvalidate = false