mirror of
https://github.com/LSPosed/LSPlant.git
synced 2025-05-04 20:42:02 +08:00
Add clone and fix assign of jObjArrEle
This commit is contained in:
parent
b435731080
commit
4ff1786610
@ -61,6 +61,10 @@ public:
|
||||
|
||||
T get() const { return local_ref_; }
|
||||
|
||||
ScopedLocalRef<T> clone() const {
|
||||
return ScopedLocalRef<T>(env_, (T)env_->NewLocalRef(local_ref_));
|
||||
}
|
||||
|
||||
operator T() const { return local_ref_; }
|
||||
|
||||
ScopedLocalRef &operator=(ScopedLocalRef &&s) noexcept {
|
||||
@ -786,6 +790,11 @@ template <typename U, typename T>
|
||||
return ScopedLocalRef<U>(std::move(x));
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
[[maybe_unused]] inline auto JNI_Cast(JObjectArrayElement &&x) {
|
||||
return JNI_Cast<U, jobject>(std::move(x));
|
||||
}
|
||||
|
||||
[[maybe_unused]] inline auto JNI_NewDirectByteBuffer(JNIEnv *env, void *address, jlong capacity) {
|
||||
return JNI_SafeInvoke(env, &JNIEnv::NewDirectByteBuffer, address, capacity);
|
||||
}
|
||||
@ -1072,17 +1081,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
JObjectArrayElement& operator=(ScopedLocalRef<jobject>&& s) {
|
||||
reset(s.release());
|
||||
return *this;
|
||||
}
|
||||
|
||||
JObjectArrayElement& operator=(const ScopedLocalRef<jobject>& s) {
|
||||
item_.reset(env_->NewLocalRef(s.get()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JObjectArrayElement& operator=(const jobject &s) {
|
||||
JObjectArrayElement& operator=(jobject s) {
|
||||
item_.reset(env_->NewLocalRef(s));
|
||||
return *this;
|
||||
}
|
||||
@ -1092,6 +1091,14 @@ public:
|
||||
if (item_) JNI_SafeInvoke(env_, &JNIEnv::SetObjectArrayElement, array_, i_, item_);
|
||||
}
|
||||
|
||||
ScopedLocalRef<jobject> clone() const {
|
||||
return item_.clone();
|
||||
}
|
||||
|
||||
operator jobject() const {
|
||||
return item_;
|
||||
}
|
||||
|
||||
jobject get() const { return item_.get(); }
|
||||
|
||||
jobject release() { return item_.release(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user