From 8e430e55afa9a5f0a3ceeed7446e10efbfb61e04 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Fri, 23 Jul 2021 18:01:48 +0200
Subject: [PATCH] Java/GlobalRef: add LocalRef cast constructor

---
 src/java/Ref.hxx | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/java/Ref.hxx b/src/java/Ref.hxx
index 421b3d5f0..a5ad2b0d3 100644
--- a/src/java/Ref.hxx
+++ b/src/java/Ref.hxx
@@ -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);
 	}