mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 08:25:34 +00:00
app: release GPU before processing DestroyEvent
In fact, move the release of the GPU to a deferred function, saving a release. Fixes #65 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+6
-2
@@ -218,6 +218,12 @@ func (w *Window) run(opts *window.Options) {
|
||||
w.out <- system.DestroyEvent{Err: err}
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
if w.gpu != nil {
|
||||
w.gpu.Release()
|
||||
w.gpu = nil
|
||||
}
|
||||
}()
|
||||
for {
|
||||
var timer <-chan time.Time
|
||||
if w.delayedDraw != nil {
|
||||
@@ -297,8 +303,6 @@ func (w *Window) run(opts *window.Options) {
|
||||
}
|
||||
if e2.Sync {
|
||||
if err := w.gpu.Flush(); err != nil {
|
||||
w.gpu.Release()
|
||||
w.gpu = nil
|
||||
w.destroy(err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user