It seems that I can not even detect when JNI environment is detached. Maybe invoking dl_shutdown() when the last child of top level app is removed will be a solution. But still I'm not sure this will always happen before exit func, because they execute in different thread. So, we should wait for the removeal of g_atexit() invocation in ATK bridge.
Thanks, Ke Ginn Chen wrote: > So JAW would not be detached when the exit function is called? > Can you hold a ref to the ATK bridge library to make sure it won't be > detached earlier than JAW? > > Ginn > > On Aug 20, 2009, at 10:40 AM, Ke Wang wrote: > >> The exit function will be called in a context that we can not control >> in Java. >> At the time the exit function registered by ATK bridge is called, the >> JNI environment may have been detached from JVM. >> So any callback from registryd would either crash or hang the Java >> app at that time. >> >> This is just a workaround. >> After the modification of ATK bridge's exit handler being done by Li, >> I'll do corresponding change in JAW. >> >> Thanks, >> >> Ke >> >> On 08/19/09 18:02, Ginn Chen wrote: >>> It looks like you're covering the ATK bridge bug with the same usage >>> of g_atexit(). >>> What about just not do dl_shutdown()? >>> Would it crash? >>> >>> Ginn >>> >>> On Aug 19, 2009, at 5:40 PM, Ke Wang wrote: >>> >>>> Hi all, >>>> >>>> This patch forces Java app to quit before the invocation of exit >>>> func registered by ATK bridge. >>>> >>>> Regards, >>>> >>>> Ke >>>> <AtkWrapper.diff> >>> >> >
