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
+6 -1
View File
@@ -298,6 +298,9 @@ void GameEngine::Destroy() {
#ifdef __SWITCH__
Ship::Switch::Exit();
#endif
GameUI::Destroy();
delete GameEngine::Instance;
GameEngine::Instance = nullptr;
}
bool ShouldClearTextureCacheAtEndOfFrame = false;
@@ -509,7 +512,9 @@ ImFont* GameEngine::CreateFontWithSize(float size, std::string fontPath) {
initData->Path = fontPath;
std::shared_ptr<Ship::Font> fontData = std::static_pointer_cast<Ship::Font>(
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fontPath, false, initData));
font = mImGuiIo->Fonts->AddFontFromMemoryTTF(fontData->Data, fontData->DataSize, size);
char* fontDataPtr = (char*)malloc(fontData->DataSize);
memcpy(fontDataPtr, fontData->Data, fontData->DataSize);
font = mImGuiIo->Fonts->AddFontFromMemoryTTF(fontDataPtr, fontData->DataSize, size);
}
// FontAwesome fonts need to have their sizes reduced by 2.0f/3.0f in order to align correctly
float iconFontSize = size * 2.0f / 3.0f;