From 1fa5ca27c4b855d242ee7387cbd0c51e57077dd6 Mon Sep 17 00:00:00 2001 From: MCorbo7 <84733317+MCorbo7@users.noreply.github.com> Date: Wed, 6 May 2026 15:56:20 -0300 Subject: [PATCH] Update MMFAndroidMasterHeader.hpp Potential memory leak? My android apps kept crashing while debugging a custom extension with a special looping behavior. After these changes the issue was solved. --- DarkEdif/Inc/Android/MMFAndroidMasterHeader.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DarkEdif/Inc/Android/MMFAndroidMasterHeader.hpp b/DarkEdif/Inc/Android/MMFAndroidMasterHeader.hpp index 90d63261..9f40840a 100644 --- a/DarkEdif/Inc/Android/MMFAndroidMasterHeader.hpp +++ b/DarkEdif/Inc/Android/MMFAndroidMasterHeader.hpp @@ -236,7 +236,8 @@ struct global { newO2.monitor = this->monitor; return std::move(newO2); } - global newO(this->ref, this->name); + global newO; + newO.ref = this->ref; newO.monitor = this->monitor; this->ref = nullptr; this->name = "unset [swapped out]"; @@ -248,6 +249,9 @@ struct global { LOGE("Invalid global ref at %p \"%s\" was moved!\n", this, name); raise(SIGTRAP); } + if (this->ref) { + threadEnv->DeleteGlobalRef(this->ref); + } this->ref = p.ref; this->name = p.name; this->monitor = p.monitor;