Java/GlobalRef: add LocalRef cast constructor

This commit is contained in:
Max Kellermann 2021-07-23 18:01:48 +02:00 committed by Max Kellermann
parent 9e61bda592
commit 8e430e55af
1 changed files with 3 additions and 0 deletions

View File

@ -125,6 +125,9 @@ public:
value = (T)env->NewGlobalRef(value);
}
GlobalRef(const LocalRef<T> &src) noexcept
:GlobalRef(src.GetEnv(), src.Get()) {}
~GlobalRef() noexcept {
GetEnv()->DeleteGlobalRef(value);
}