Add an early-out for non-zero internal reference count

This commit is contained in:
Luke Usher 2019-07-17 10:10:51 +01:00
parent bd3569ff95
commit 4190b81431
1 changed files with 8 additions and 3 deletions

View File

@ -5577,10 +5577,15 @@ ULONG WINAPI XTL::EMUPATCH(D3DResource_Release)
// Was the Xbox resource freed? // Was the Xbox resource freed?
if (uRet == 0) { if (uRet == 0) {
// We should free any variables storing the resource when freed // We should free any variables storing the resource when freed
// HACK: For now, we skip the release and issue a LOG_TEST_CASE // HACK: For now, we skip the release when the resource has a non-zero internal ref count
// We also skip the release if we still have a cached variable containing this value
// This is a (small) memory leak, but prevents incorrectly freeing an in-use resource // This is a (small) memory leak, but prevents incorrectly freeing an in-use resource
// This is a *temporary* work around until solving // This is a *temporary* work around until solving https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/1665
// https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/1665 if ((pThis->Common & X_D3DCOMMON_INTREFCOUNT_MASK) != 0) {
LOG_TEST_CASE("Skipping Release of resource with a non-zero internal reference count");
RETURN(uRet);
}
if (pThis == g_pXboxRenderTarget) { if (pThis == g_pXboxRenderTarget) {
LOG_TEST_CASE("Skipping release of active Xbox Render Target"); LOG_TEST_CASE("Skipping release of active Xbox Render Target");
RETURN(uRet); RETURN(uRet);