File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ impl crate::native::Clipboard for AndroidClipboard {
344344 return None ;
345345 }
346346
347- let text = ndk_utils:: get_utf_str!( env, text) . to_string ( ) ;
347+ let text = ndk_utils:: get_utf_str!( env, text) ;
348348 Some ( text)
349349 }
350350 }
Original file line number Diff line number Diff line change @@ -73,9 +73,13 @@ macro_rules! call_bool_method {
7373#[ macro_export]
7474macro_rules! get_utf_str {
7575 ( $env: expr, $obj: expr) => { {
76- let string = ( * * $env) . GetStringUTFChars . unwrap( ) ( $env, $obj, std:: ptr:: null_mut( ) ) ;
77- let string = std:: ffi:: CStr :: from_ptr( string) ;
78- string. to_str( ) . unwrap( )
76+ let cstr_dat = ( * * $env) . GetStringUTFChars . unwrap( ) ( $env, $obj, std:: ptr:: null_mut( ) ) ;
77+ let string = std:: ffi:: CStr :: from_ptr( cstr_dat)
78+ . to_str( )
79+ . unwrap( )
80+ . to_string( ) ;
81+ ( * * $env) . ReleaseStringUTFChars . unwrap( ) ( $env, $obj, cstr_dat) ;
82+ string
7983 } } ;
8084}
8185
You can’t perform that action at this time.
0 commit comments