Alexandr Miloslavskiy <alexandr.miloslavskiy {_AT_} syntevo.com>


Review
r1880886

r1880886 | hartmannathan | 2020-08-16 04:39:55 +0000 (Sun, 16 Aug 2020)

Fix crash in JavaHL JNI wrapper caused by object lifetimes

See dev@ email thread "JNI segfault while running Java tests" started
2020/08/08, archived at:

https://lists.apache.org/thread.html/rff3fa5ea97267adf36cc9daa3be01392e53fbc8050a91df4bbac01d8%40%3Cdev.subversion.apache.org%3E
https://svn.haxx.se/dev/archive-2020-08/0010.shtml

* subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp
  (Java::BaseImmutableMap::Entry::key): As the locally-scoped String::Contents
    object keeps a reference to a String, ensure the String will remain in
    scope for the lifetime of the String::Contents object by instantiating it
    as a local variable.

Reported by: jamessan

Patch by: Daniel Sahlberg <daniel.l.sahlberg {_AT_} gmail.com>

Reviewed by: Alexandr Miloslavskiy <alexandr.miloslavskiy {_AT_} syntevo.com>
             hartmannathan

Tested by: jamessan