Skip to content

Commit 80dfd1c

Browse files
fix close when minimized not making our CResizableSurface irrecoverable
1 parent 8c69d10 commit 80dfd1c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/nbl/video/utilities/CResizableSurface.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ class NBL_API2 IResizableSurface : public ISimpleManagedSurface
6464
inline VkExtent2D getCurrentExtent()
6565
{
6666
std::unique_lock guard(m_swapchainResourcesMutex);
67-
// if got some weird invalid extent, try to recreate and retry once
67+
// because someone might skip an acquire when area==0, handle window closing
68+
if (m_cb->isWindowOpen())
6869
while (true)
6970
{
7071
auto resources = getSwapchainResources();
71-
if (resources)
72+
if (resources && resources->getStatus()==ISwapchainResources::STATUS::USABLE)
7273
{
7374
auto swapchain = resources->getSwapchain();
7475
if (swapchain)
@@ -78,9 +79,12 @@ class NBL_API2 IResizableSurface : public ISimpleManagedSurface
7879
return {params.width,params.height};
7980
}
8081
}
82+
// if got some weird invalid extent, try to recreate and retry once
8183
if (!recreateSwapchain())
8284
break;
8385
}
86+
else
87+
becomeIrrecoverable();
8488
return {0,0};
8589
}
8690

0 commit comments

Comments
 (0)