diff --git a/inc/smjni/java_frame.h b/inc/smjni/java_frame.h index 93c3517..f49437e 100644 --- a/inc/smjni/java_frame.h +++ b/inc/smjni/java_frame.h @@ -43,6 +43,21 @@ namespace smjni if (m_pushed) m_env->PopLocalFrame(nullptr); } + + java_frame(java_frame && src): + m_env(std::exchange(src.m_env, nullptr)), + m_pushed(std::exchange(src.m_pushed, false)) + { + } + + java_frame & operator=(java_frame && src) + { + if (this != &src) { + this->~java_frame(); + new (this) java_frame(std::move(src)); + } + return *this; + } template T pop(T obj) @@ -57,8 +72,6 @@ namespace smjni java_frame(const java_frame &) = delete; java_frame & operator=(const java_frame &) = delete; - java_frame(java_frame &&) = delete; - java_frame & operator=(java_frame &&) = delete; private: JNIEnv * m_env; bool m_pushed;