Exemplo n.º 1
0
 public void Release(JniEnvironment environment)
 {
     if (this.IsDead)
     {
         return;
     }
     VerifyEnvironment(environment);
     if (this.mLifeCycle == JniObjectLifecycle.Global || this.mLifeCycle == JniObjectLifecycle.GlobalAutoRelease)
     {
         JniEnvironment.Functions.DeleteGlobalRef(environment.Handle, this.Handle);
         // EXCEPTION CHECK: Do nothing, this method safe to call while exception is pending, does
         // not raise additional exceptions.
     }
     else if (this.mLifeCycle == JniObjectLifecycle.Local || this.mLifeCycle == JniObjectLifecycle.LocalJ2N)
     {
         if (this.mLifeCycle == JniObjectLifecycle.Local)
         {
             environment.RemoveFromCurrentFrame(this);
         }
         JniEnvironment.Functions.DeleteLocalRef(environment.Handle, this.Handle);
         // EXCEPTION CHECK: Do nothing, this method safe to call while exception is pending, does
         // not raise additional exceptions.
     }
     MakeDead();
 }