mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-15 00:24:19 +00:00
Android: fix crash when calling juce::JUCEApplicationBase::quit().
This commit is contained in:
parent
4955271ce0
commit
3237d50f0e
3 changed files with 92 additions and 56 deletions
|
|
@ -955,15 +955,29 @@ public class JuceAppActivity extends Activity
|
|||
//==============================================================================
|
||||
public static class NativeInvocationHandler implements InvocationHandler
|
||||
{
|
||||
public NativeInvocationHandler (long nativeContextRef)
|
||||
{
|
||||
public NativeInvocationHandler (Activity activityToUse, long nativeContextRef)
|
||||
{
|
||||
activity = activityToUse;
|
||||
nativeContext = nativeContextRef;
|
||||
}
|
||||
|
||||
public void nativeContextDeleted()
|
||||
{
|
||||
nativeContext = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalize()
|
||||
{
|
||||
dispatchFinalize (nativeContext);
|
||||
activity.runOnUiThread (new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (nativeContext != 0)
|
||||
dispatchFinalize (nativeContext);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -972,16 +986,22 @@ public class JuceAppActivity extends Activity
|
|||
return dispatchInvoke (nativeContext, proxy, method, args);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//==============================================================================
|
||||
Activity activity;
|
||||
private long nativeContext = 0;
|
||||
|
||||
private native void dispatchFinalize (long nativeContextRef);
|
||||
private native Object dispatchInvoke (long nativeContextRef, Object proxy, Method method, Object[] args);
|
||||
}
|
||||
|
||||
public static InvocationHandler createInvocationHandler (long nativeContextRef)
|
||||
public InvocationHandler createInvocationHandler (long nativeContextRef)
|
||||
{
|
||||
return new NativeInvocationHandler (nativeContextRef);
|
||||
return new NativeInvocationHandler (this, nativeContextRef);
|
||||
}
|
||||
|
||||
public void invocationHandlerContextDeleted (InvocationHandler handler)
|
||||
{
|
||||
((NativeInvocationHandler) handler).nativeContextDeleted();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue