dropbox / djinni

A tool for generating cross-language type declarations and interface bindings.
Apache License 2.0
2.88k stars 488 forks source link

Why is my bridge loaded then unloaded (iOS) ? #370

Closed omatrot closed 6 years ago

omatrot commented 6 years ago

I'm using djinni and encounter a problem on iOS only.

When starting the app from XCode, my bridge is initialized... then destroyed with the following stack trace:

#0  0x000000010837a79a in djinnius::HelloWorldImpl::~HelloWorldImpl() at /Users/omatrot/Documents/b2bot/sandbox/react-native-djinnius/src/cpp/hello_world_impl.cpp:23
#1  0x000000010837a885 in djinnius::HelloWorldImpl::~HelloWorldImpl() at /Users/omatrot/Documents/b2bot/sandbox/react-native-djinnius/src/cpp/hello_world_impl.cpp:22
#2  0x000000010837be09 in std::__1::__shared_ptr_emplace<djinnius::HelloWorldImpl, std::__1::allocator<djinnius::HelloWorldImpl> >::__on_zero_shared() at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3610
#3  0x00000001086020c1 in std::__1::__shared_count::__release_shared() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3444
#4  0x00000001086020b8 in std::__1::__shared_weak_count::__release_shared() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3486
#5  0x00000001086020b8 in std::__1::shared_ptr<djinnius::HelloWorld>::~shared_ptr() at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:4412
#6  0x00000001086022a2 in std::__1::shared_ptr<djinnius::HelloWorld>::~shared_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:4410
#7  0x000000010860229a in djinni::ProxyCache<djinni::CppProxyCacheTraits>::Handle<std::__1::shared_ptr<djinnius::HelloWorld>, std::__1::shared_ptr<djinnius::HelloWorld> >::~Handle() at /Users/omatrot/Documents/b2bot/sandbox/react-native-djinnius/deps/djinni/support-lib/objc/../proxy_cache_interface.hpp:137
#8  0x0000000109426920 in object_cxxDestructFromClass(objc_object*, objc_class*) ()
#9  0x0000000109432502 in objc_destructInstance ()
#10 0x0000000109432539 in object_dispose ()
#11 0x000000010943ca6e in objc_object::sidetable_release(bool) ()
#12 0x000000010aa9f64d in -[__NSDictionaryI dealloc] ()
#13 0x000000010943ca6e in objc_object::sidetable_release(bool) ()
#14 0x000000010943d1b2 in (anonymous namespace)::AutoreleasePoolPage::pop(void*) ()
#15 0x000000010aa86136 in _CFAutoreleasePoolPop ()
#16 0x0000000108e68e16 in __NSThreadPerformPerform ()
#17 0x000000010aadebb1 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#18 0x000000010aac34af in __CFRunLoopDoSources0 ()
#19 0x000000010aac2a6f in __CFRunLoopRun ()
#20 0x000000010aac230b in CFRunLoopRunSpecific ()
#21 0x000000010839403b in ::+[RCTCxxBridge runRunLoop]() at /Users/omatrot/Documents/b2bot/sandbox/react-native-djinnius/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:246
#22 0x0000000108e313b3 in __NSThread__start__ ()
#23 0x000000010fb8b661 in _pthread_body ()
#24 0x000000010fb8b50d in _pthread_start ()
#25 0x000000010fb8abf9 in thread_start ()

It is then unavailable to the Javascript side. What could be the case of this problem ?

Thanks in advance.

artwyman commented 6 years ago

From context your issue sounds quite specific to React Native, not to the Djinni tool in general. Did you pull your code from a Djinni fork with React Native support? Perhaps this one? If so you should report issues over there, since the Djinni tool has no specific support for React Native.

omatrot commented 6 years ago

Yes I started from this Djinni fork. Thanks I'll report the issue here.