Client: Cleanup vulkan surfaces on hide
Otherwise a hide/show combination will result in use of wl_surface after it has been destroyed by QWaylandWindow. This closely matches what the pattern we use for QWaylandEGLWindow. Pick-to: 6.5 Change-Id: Ic23f947046ce521125dfa8a3c22f5529dfcbece2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
e786b30e23
commit
eabe2a039b
@ -14,11 +14,7 @@ QWaylandVulkanWindow::QWaylandVulkanWindow(QWindow *window, QWaylandDisplay *dis
|
||||
|
||||
QWaylandVulkanWindow::~QWaylandVulkanWindow()
|
||||
{
|
||||
if (m_surface) {
|
||||
QVulkanInstance *inst = window()->vulkanInstance();
|
||||
if (inst)
|
||||
static_cast<QWaylandVulkanInstance *>(inst->handle())->destroySurface(m_surface);
|
||||
}
|
||||
invalidateSurface();
|
||||
}
|
||||
|
||||
QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const
|
||||
@ -26,6 +22,17 @@ QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const
|
||||
return QWaylandWindow::Vulkan;
|
||||
}
|
||||
|
||||
void QWaylandVulkanWindow::invalidateSurface()
|
||||
{
|
||||
if (m_surface) {
|
||||
QVulkanInstance *inst = window()->vulkanInstance();
|
||||
if (inst)
|
||||
static_cast<QWaylandVulkanInstance *>(inst->handle())->destroySurface(m_surface);
|
||||
}
|
||||
m_surface = nullptr;
|
||||
QWaylandWindow::invalidateSurface();
|
||||
}
|
||||
|
||||
VkSurfaceKHR *QWaylandVulkanWindow::vkSurface()
|
||||
{
|
||||
if (m_surface)
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
~QWaylandVulkanWindow() override;
|
||||
|
||||
WindowType windowType() const override;
|
||||
void invalidateSurface() override;
|
||||
|
||||
VkSurfaceKHR *vkSurface();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user