On Mon, Mar 7, 2016 at 9:50 AM, Andrii Heonia <[email protected]> wrote:
> This is demo with global callback: > https://github.com/AndriiHeonia/async-emcc/tree/7207aebdcc65b5d183f1a26516ccdd77eb06ce8e > and > it also doesn't work. My callback dies before async call even if it is > global (and I don't get how to keep it alive) > Yeah, I'm seeing the same thing with this example, can't quite see what's forcing the object to get deleted after the sync call code-path. Seems the same if I switch from raw pointers to std::shared_ptr... Andrii, if you can't get this worked out I would recommend switching from storing the Callback in a C++ global to instantiating an App object from the JS side and letting the Callback instance live as a member variable in the App instance. This should allow you to control the lifetime of the App instance from the JS side more explicitly (eg, it should stay alive until you explicitly destroy it from JS). -- brion -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
