Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.13
-
None
Description
We have some custom QML comboboxes that use QML Window for the popovers.
To conserve GPU memory after they are initialized, we call on them:
// Release SceneGraph when hiding window window->setPersistentSceneGraph( false ); // Release RHI (and GPU memory) if SG being release above too window->setPersistentOpenGLContext( false );
This triggers a crash if window is reopened (recreated). For some reason the crash only occurs if the window width changes on the reopen. The general cause of the crash is:
- new frame has been started (primary VkCommand has been created)
- frame has been interrupted with a call to releaseSwapChainResources()
- the above call destroys the primary VkCommands
- but left the inFrame flag untouched
- next call to beginFrame() was not recreating the VkCommand as it assumed that it just needs to continue work on the prevously abandoned one
- crash due to use of nullptr VkCommand
My fix:
@@ -1500,12 +1500,14 @@ void QRhiVulkan::releaseSwapChainResources(QRhiSwapChain *swapChain) if (swapChainD->sc == VK_NULL_HANDLE) return; if (!deviceLost) df->vkDeviceWaitIdle(dev); + inFrame = false; + for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) {