shannah / Java-Objective-C-Bridge

A thin bridge that allows for two-way communication from Java to Objective-C.
123 stars 25 forks source link

Crash prevention #11

Open mojo2012 opened 5 years ago

mojo2012 commented 5 years ago

I get a lot of vm crashes during development:

A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff5e76069d, pid=85121, tid=775
#
# JRE version: OpenJDK Runtime Environment (11.0.1+13) (build 11.0.1+13)
# Java VM: OpenJDK 64-Bit Server VM (11.0.1+13, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libobjc.A.dylib+0x669d]  objc_msgSend+0x1d

Obviously those exceptions cannot be caught like I did with in my PR, because they happen in the objective-c runtime library. Would it be possible to wrap the calls within our own library like this here: https://blog.timac.org/2012/1218-simple-code-injection-using-dyld_insert_libraries/

I'm not too familiar with all this objc magic let alone c :-D Any idea if this might work?