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;