app: [android] fix vulkan crash when activity/surface is recreated

On Android it's possible that the Activity/View must be restore. But,
before that patch, an new VkSurfaceKHR is created but never used and
that may lead to crash, in an attempt to destroy/use one invalid
surface.

Fixes: https://todo.sr.ht/~eliasnaur/gio/327
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
Inkeliz
2021-12-27 19:53:48 +00:00
committed by Elias Naur
parent 3a20330d82
commit 6913c856a2
+3 -1
View File
@@ -79,10 +79,12 @@ func (c *wlVkContext) Refresh() error {
if c.surf != 0 {
c.ctx.destroySwapchain()
vk.DestroySurface(c.inst, c.surf)
c.surf = 0
}
surf, err := vk.CreateAndroidSurface(c.inst, unsafe.Pointer(win))
if err != nil {
return err
}
return c.ctx.refresh(surf, w, h)
c.surf = surf
return c.ctx.refresh(c.surf, w, h)
}