hyperfiction / HypFacebook

HypFacebook : Facebook native extension for Haxe NME
BSD 2-Clause "Simplified" License
45 stars 17 forks source link

crash on Android when sending callbacks #10

Open ninja-gaiden opened 10 years ago

ninja-gaiden commented 10 years ago

Application crashes when HypFacebook.hx calls HypFacebook.java method jni_connect and then Java sends Event callback using CPP

07-01 18:14:36.644: I/trace(7994): Java_fr_hyperfiction_HypFacebook_onFBEvent
07-01 18:14:36.644: I/trace(7994): hypfb_dispatch_event
07-01 18:14:36.649: A/libc(7994): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 8033 (Thread-33545)

lines in ExternalInterface.cpp that cause this error

        int top = 0;
        gc_set_top_of_stack(&top, true);
        gc_exit_blocking();
        #endif
        val_call3(
                    eval_onEvent->get( ) ,
                    alloc_string( sType ) ,
                    alloc_string( sArg1 ) ,
                    alloc_string( sArg2 )
                );
        #ifdef ANDROID
        gc_enter_blocking();
        #endif

I've edited HypFacebook.java a bit to avoid this CPP code completely and send callback to HaxeObject without that stuff - everything seems to work now but still I'm wondering why this code crashes on my Galaxy S3

Haxe Compiler 3.1.3
actuate: 1.52 1.6.3 1.7.1 1.7.2 [1.7.5]
format: 3.0.4 [3.0.5]
haxelib_client: [3.1.0-rc.4]
hxcpp: 2.10.3 3.0.2 3.1.21 3.1.30 [3.1.39]
hxlibc: 1.1.1 [1.1.4]
hxtools: [1.1.6]
inthebox-macros: [1.1.0]
lime-tools: 1.2.2 1.4.0 [1.5.7]
lime: 0.9.0 0.9.7 [1.0.1]
nme: 4.0.2 5.0.37 [5.1.8]
openfl-compatibility: [1.0.1]
openfl-html5: 1.0.1 1.0.2 1.0.5 [1.4.2-beta]
openfl-native: 1.0.1 1.2.0 [1.4.0]
openfl-samples: 1.0.0-rc.1 1.2.0 [1.3.0]
openfl-tools: 1.0.0 [1.0.10] 1.0.2
openfl: 1.0.1 1.0.4 1.0.5 1.2.0 1.2.1 1.2.2 1.4.0 [2.0.1]
svg: 1.0.7 [1.0.8] 1.04
swf: 1.0.0 1.0.1 1.0.2 1.17 1.2.0 1.4.2 [1.5.2]
shoebox commented 10 years ago

cf https://github.com/openfl/openfl-native/issues/216 (just debugged it today !)

Or use OpenFl version < 1.4

ninja-gaiden commented 10 years ago

Great news, thanks