mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user