Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with new NSDictionary() #100

Open
marcprux opened this issue Jan 3, 2018 · 0 comments
Open

Crash with new NSDictionary() #100

marcprux opened this issue Jan 3, 2018 · 0 comments

Comments

@marcprux
Copy link

marcprux commented Jan 3, 2018

BridJ's mvn test crashes after adding the following to ObjectiveCTest.java:

    @Test
    public void testNewNSDictionary() {
        if (!mac) return;
        NSDictionary dict = new NSDictionary();
    }   

The resulting hs_err_pid23369.log crash log starts with:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x00007fff57553c64, pid=23369, tid=0x0000000000001903
#
# JRE version: Java(TM) SE Runtime Environment (8.0_151-b12) (build 1.8.0_151-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.151-b12 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [CoreFoundation+0x13ec64]  -[__NSDictionary0 init]+0x4
#

Interestingly, if you rename "NSDictionary" to "NSCFDictionary", then it constructs fine. This makes me suspect that it has to do with the foundation collections being class clusters. End-user code could work around this by just using the static initializer methods to construct these instances, but the same crash will happen with any code that returns a Pointer, since BridJ will invoke the default constructor from org.bridj.CRuntime$CTypeInfo.newCastInstance(CRuntime.java:199).

Has any thought been given to supporting class clusters in the ObjC bindings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant