JNI wrapper for NSSavePanel

Steve Hannah steve at weblite.ca
Mon Oct 8 14:12:26 PDT 2012


I have written a short tutorial on this, my first adventure with JNI, so
that others might be able to learn from my failures.

http://www.shannah.ca/blog/?p=217

Thanks again for all the help.

Steve

On Sun, Oct 7, 2012 at 11:26 PM, Mike Swingler <swingler at apple.com> wrote:

> On Oct 7, 2012, at 10:44 PM, Steve Hannah <steve at weblite.ca> wrote:
>
> And one more long-shot: are you compiling your JNI library as ARC, or
>> manual retain/release? I very much doubt that JNF will work correctly with
>> compiler-generated ARC calls...but I could be surprised.
>>
>
> Your long shot was the money shot!  ARC was turned on.  After disabling
> it, everything works as it should.  Thank you so much for your help.  It is
> quite likely that I would have had to spend a month of Sundays solving this
> problem if not for your help on this.
>
>
> Awesome. Something about that raw objc_retain() straight out of the
> generated Java call was bugging me, and in retrospect I should have
> recognized it as the blatant preamble/postscript that gets generated around
> and in functions that are built with ARC.
>
> Suffice it to say, this is fair warning against those who would try to mix
> JNI and ARC. For now, don't. Just stick with MRR.
>
> Perhaps the JNF functions and macros could be sufficiently decorated with
> clang attributes to avoid this kind of problem, but I'd have to really
> think through the edge cases of how ARC interacts with the JNF autorelease
> pool management to be sure we got it right. If this is actually of any
> interest to anyone out there in the real world, please feel free to file a
> bug at <http://bugreporter.apple.com> - though, if using MRR is good
> enough, maybe it's just good enough.
>
> Always happy to help,
> Mike Swingler
> Apple Inc.
>
>


-- 
Steve Hannah
Web Lite Solutions Corp.


More information about the macosx-port-dev mailing list