fix memory leaks, avoid invalidate texture (#207)

* Fixed macos

* More stupid fixes

* update with main and update torch and lus and enable action on this branch

* Update FrameInterpolation.h

* Update FrameInterpolation.cpp

* fix some memory leak

* Update torch

* Update torch

* update torch and lus

* reduce texture import

* don't use fork of torch and lus

* Update torch

* Update torch

---------

Co-authored-by: Lywx <kiritodev01@gmail.com>
This commit is contained in:
coco875
2025-05-23 22:49:06 +00:00
committed by GitHub
parent af4535c3c5
commit 9363e3d776
20 changed files with 130 additions and 29 deletions
+15 -4
View File
@@ -30,6 +30,11 @@ namespace Editor {
Editor::Editor() {
}
Editor::~Editor() {
ClearObjects();
ClearMatrixPool();
}
void Editor::Load() {
printf("Editor: Loading Editor...\n");
eObjectPicker.Load();
@@ -58,10 +63,16 @@ namespace Editor {
Ship::Coords mousePos = wnd->GetMousePos();
bool isMouseDown = wnd->GetMouseState(Ship::LUS_MOUSE_BTN_LEFT);
eGameObjects.erase(
std::remove_if(eGameObjects.begin(), eGameObjects.end(),
[](const auto& object) { return (*object->DespawnFlag) == object->DespawnValue; }),
eGameObjects.end());
auto it = std::remove_if(eGameObjects.begin(), eGameObjects.end(),
[](auto& object) {
if (*object->DespawnFlag == object->DespawnValue) {
delete object; // Free the pointed-to memory
return true; // Remove the pointer from the vector
}
return false;
});
eGameObjects.erase(it, eGameObjects.end());
if (isMouseDown && !wasMouseDown) {
// Mouse just pressed (Pressed state)