mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-10 18:21:14 +00:00
Plug memory leaks while moving around in the Information Center (#768)
Some checks failed
CI / clang-format (push) Has been cancelled
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Has been cancelled
CI / C++ (push) Has been cancelled
Docker / Publish web port (push) Has been cancelled
CI / Release (push) Has been cancelled
Some checks failed
CI / clang-format (push) Has been cancelled
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Has been cancelled
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Has been cancelled
CI / C++ (push) Has been cancelled
Docker / Publish web port (push) Has been cancelled
CI / Release (push) Has been cancelled
Plug all leaks when moving around in the Information Center. This does not include: - loading a save game - starting a new game - selecting a LEGO character and enter the world - launching a paper plane on the observation deck
This commit is contained in:
parent
bd537c3f1b
commit
7fc4080a15
@ -203,6 +203,8 @@ LegoGameState::~LegoGameState()
|
||||
}
|
||||
|
||||
delete[] m_savePath;
|
||||
|
||||
delete LegoOmni::GetInstance()->GetUserActor();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10039780
|
||||
|
||||
@ -157,6 +157,7 @@ void LegoPhonemePresenter::EndAction()
|
||||
TextureContainer()->EraseCached(phoneme->GetCachedTextureInfo());
|
||||
TextureContainer()->EraseCached(phoneme->GetTextureInfo());
|
||||
cursor.Destroy();
|
||||
phoneme = NULL;
|
||||
}
|
||||
else {
|
||||
phoneme->SetCount(phoneme->GetCount() - 1);
|
||||
@ -167,5 +168,9 @@ void LegoPhonemePresenter::EndAction()
|
||||
CharacterManager()->ReleaseActor(m_roiName.GetData());
|
||||
}
|
||||
}
|
||||
else {
|
||||
delete phoneme;
|
||||
phoneme = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ void LegoTextureContainer::EraseCached(LegoTextureInfo* p_textureInfo)
|
||||
if ((*it).first == p_textureInfo) {
|
||||
(*it).second = FALSE;
|
||||
|
||||
if (p_textureInfo->m_texture->Release() == TRUE) {
|
||||
if (p_textureInfo->m_texture->Release() == 1) {
|
||||
delete p_textureInfo;
|
||||
m_cached.erase(it);
|
||||
}
|
||||
|
||||
@ -43,7 +43,13 @@ inline Result LightSetColor(IDirect3DRMFrame2* pLight, float r, float g, float b
|
||||
result = ResultVal(lights->GetElement(0, &light));
|
||||
assert(Succeeded(result));
|
||||
|
||||
return ResultVal(light->SetColorRGB(r, g, b));
|
||||
lights->Release();
|
||||
|
||||
result = ResultVal(light->SetColorRGB(r, g, b));
|
||||
|
||||
light->Release();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a37e0
|
||||
|
||||
@ -25,16 +25,6 @@ HRESULT Direct3DRMMeshImpl::Clone(int flags, GUID iid, void** object)
|
||||
|
||||
auto* clone = new Direct3DRMMeshImpl(*this);
|
||||
|
||||
for (auto& group : clone->m_groups) {
|
||||
// Reusing the same texture and material on the new mesh instead of cloning them might not be correct
|
||||
if (group.texture) {
|
||||
group.texture->AddRef();
|
||||
}
|
||||
if (group.material) {
|
||||
group.material->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
*object = static_cast<IDirect3DRMMesh*>(clone);
|
||||
return DD_OK;
|
||||
}
|
||||
@ -154,12 +144,13 @@ HRESULT Direct3DRMMeshImpl::SetGroupMaterial(D3DRMGROUPINDEX groupIndex, IDirect
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
material->AddRef();
|
||||
|
||||
auto& group = m_groups[groupIndex];
|
||||
if (group.material) {
|
||||
group.material->Release();
|
||||
}
|
||||
|
||||
material->AddRef();
|
||||
m_groups[groupIndex].material = material;
|
||||
return DD_OK;
|
||||
}
|
||||
@ -170,15 +161,13 @@ HRESULT Direct3DRMMeshImpl::SetGroupTexture(D3DRMGROUPINDEX groupIndex, IDirect3
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
texture->AddRef();
|
||||
|
||||
auto& group = m_groups[groupIndex];
|
||||
if (group.texture) {
|
||||
group.texture->Release();
|
||||
}
|
||||
|
||||
texture->AddRef();
|
||||
if (group.texture) {
|
||||
group.texture->Release();
|
||||
}
|
||||
group.texture = texture;
|
||||
group.version++;
|
||||
return DD_OK;
|
||||
|
||||
@ -232,13 +232,14 @@ HRESULT DirectDrawSurfaceImpl::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
|
||||
m_texture->Changed(FALSE, TRUE);
|
||||
}
|
||||
|
||||
lpDDPalette->AddRef();
|
||||
|
||||
if (m_palette) {
|
||||
m_palette->Release();
|
||||
}
|
||||
|
||||
m_palette = lpDDPalette;
|
||||
SDL_SetSurfacePalette(m_surface, ((DirectDrawPaletteImpl*) m_palette)->m_palette);
|
||||
m_palette->AddRef();
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -214,13 +214,14 @@ HRESULT FrameBufferImpl::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
|
||||
MINIWIN_NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
lpDDPalette->AddRef();
|
||||
|
||||
if (m_palette) {
|
||||
m_palette->Release();
|
||||
}
|
||||
|
||||
m_palette = lpDDPalette;
|
||||
SDL_SetSurfacePalette(m_transferBuffer->m_surface, ((DirectDrawPaletteImpl*) m_palette)->m_palette);
|
||||
m_palette->AddRef();
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -21,8 +21,8 @@ struct Direct3DRMObjectBaseImpl : public T {
|
||||
it->first(this, it->second);
|
||||
}
|
||||
m_callbacks.clear();
|
||||
SDL_free(m_name);
|
||||
}
|
||||
SDL_free(m_name);
|
||||
return this->T::Release();
|
||||
}
|
||||
HRESULT AddDestroyCallback(D3DRMOBJECTCALLBACK callback, void* arg) override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user