Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
JNI + SDL = Cocoa Thread issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JNI + SDL = Cocoa Thread issues



Hi guys. I'm working on a new set of SDL bindings since the only ones out there seem to be at least 6 years old. I have the basics working under Linux and webOS (compiled for ARM) but I'm having problems on MacOSX.

I'm getting error 1002 like this:

2010-01-10 20:27:54.787 cocoatest[55526:a0f] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'


when I launch the SDL stub from my Java code.  I managed to hack the SDL_main.m to init cocoa from my Java code and now I'm getting this error:

     [java] 2011-08-30 16:48:14.946 java[41722:1903] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-833.1/Misc.subproj/NSUndoManager.m:324
     [java] 2011-08-30 16:48:14.946 java[41722:1903] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
     [java] 2011-08-30 16:48:14.947 java[41722:1903] (
     [java] 0   CoreFoundation                      0x00007fff8d490986 __exceptionPreprocess + 198
     [java] 1   libobjc.A.dylib                     0x00007fff8cdf4d5e objc_exception_throw + 43
     [java] 2   CoreFoundation                      0x00007fff8d4907ba +[NSException raise:format:arguments:] + 106
     [java] 3   Foundation                          0x00007fff8c36514f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 169
     [java] 4   Foundation                          0x00007fff8c2d435c +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 144
     [java] 5   AppKit                              0x00007fff891fa454 -[NSApplication run] + 589
     [java] 6   libsdljava.jnilib                   0x000000010f538004 CustomApplicationMain + 548
     [java] 7   libsdljava.jnilib                   0x000000010f5387b1 main2 + 369
     [java] 8   libsdljava.jnilib                   0x000000010f53183f doit + 95
     [java] 9   libsdljava.jnilib                   0x000000010f537485 Java_com_joshondesign_sdljava_sdlJNI_doit + 21
     [java] 10  ???                                 0x00000001082ddd6e 0x0 + 4432190830
     [java] 11  ???                                 0x00000001082d285a 0x0 + 4432144474
     [java] 12  ???                                 0x00000001082d285a 0x0 + 4432144474
     [java] 13  ???                                 0x00000001082cd438 0x0 + 4432122936
     [java] 14  libclient64.dylib                   0x000000010781f6ca JVM_Lseek + 193192
     [java] 15  libclient64.dylib                   0x000000010781f48e JVM_Lseek + 192620
     [java] 16  libclient64.dylib                   0x0000000107842a11 JVM_FindLoadedClass + 3187
     [java] 17  libclient64.dylib                   0x00000001078428b9 JVM_FindLoadedClass + 2843
     [java] 18  java                                0x00000001076deceb java + 11499
     [java] 19  java                                0x00000001076df238 java + 12856
     [java] 20  libsystem_c.dylib                   0x00007fff84bf68bf _pthread_start + 335
     [java] 21  libsystem_c.dylib                   0x00007fff84bf9b75 thread_start + 13
     [java] )


So I'm what to do next.  This is not a Swing/AWT app so I don't want the Java code on the AWT thread. Instead I really do want it to run on the same thread that it would if it were C code.  How can I do that?



thanks,
Josh

PS: Mike: support for full screen apps from Java for Lion would rock!
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.