Windows deallocation fixes

This commit is contained in:
Jack Andersen 2018-05-28 10:23:20 -10:00
parent 3028e34b51
commit 6ff4229f9b
4 changed files with 18 additions and 5 deletions

View File

@ -2786,6 +2786,7 @@ struct VulkanCommandQueue : IGraphicsCommandQueue
m_running = false;
if (m_submitted && vk::GetFenceStatus(m_ctx->m_dev, m_drawCompleteFence) == VK_NOT_READY)
vk::WaitForFences(m_ctx->m_dev, 1, &m_drawCompleteFence, VK_FALSE, -1);
stallDynamicUpload();
static_cast<VulkanDataFactoryImpl*>(m_parent->getDataFactory())->DestroyGammaResources();
m_drawResTokens[0].clear();
m_drawResTokens[1].clear();

View File

@ -407,6 +407,13 @@ public:
return clientReturn;
}
~ApplicationWin32()
{
for (auto& p : m_allWindows)
if (auto w = p.second.lock())
w->_cleanup();
}
SystemStringView getUniqueName() const
{
return m_uniqueName;
@ -506,7 +513,10 @@ int ApplicationRun(IApplication::EPlatformType platform,
APP = new ApplicationWin32(cb, uniqueName, friendlyName, pname, args,
gfxApi, samples, anisotropy, deepColor, singleInstance);
return APP->run();
int ret = APP->run();
delete APP;
APP = nullptr;
return ret;
}
}

View File

@ -1018,9 +1018,9 @@ public:
m_gfxCtx.reset(new GraphicsContextWin32D3D(api, this, m_hwnd, b3dCtx));
}
~WindowWin32()
void _cleanup()
{
m_gfxCtx.reset();
}
void setCallback(IWindowCallback* cb)

View File

@ -613,7 +613,9 @@ int WINAPIV main(Platform::Array<Platform::String^>^ params)
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
{
int argc = 0;
const boo::SystemChar** argv = (const wchar_t**)(CommandLineToArgvW(lpCmdLine, &argc));
const boo::SystemChar** argv;
if (lpCmdLine[0])
argv = (const wchar_t**)(CommandLineToArgvW(lpCmdLine, &argc));
static boo::SystemChar selfPath[1024];
GetModuleFileNameW(nullptr, selfPath, 1024);
static const boo::SystemChar* booArgv[32] = {};