Android: Fixed possible crash with a session being null

This commit is contained in:
Martin Fleisz 2013-04-18 03:43:52 -07:00
parent 50c94186e8
commit 6b48a8c7c5
2 changed files with 6 additions and 8 deletions

View File

@ -194,8 +194,7 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener
{
Log.v("LibFreeRDP", "OnConnectionFailure");
// free session
GlobalApp.freeSession(instance);
// send notification to session activity
sendRDPNotification(FREERDP_EVENT_CONNECTION_FAILURE, instance);
}
@ -210,8 +209,5 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener
public void OnDisconnected(int instance)
{
Log.v("LibFreeRDP", "OnDisconnected");
// free session
GlobalApp.freeSession(instance);
}
}

View File

@ -256,7 +256,6 @@ public class SessionActivity extends Activity
if (!connectCancelledByUser)
uiHandler.sendMessage(Message.obtain(null, UIHandler.DISPLAY_TOAST, getResources().getText(R.string.error_connection_failure)));
session = null;
closeSessionActivity(RESULT_CANCELED);
}
@ -271,7 +270,6 @@ public class SessionActivity extends Activity
}
session.setUIEventListener(null);
session = null;
closeSessionActivity(RESULT_OK);
}
}
@ -518,9 +516,13 @@ public class SessionActivity extends Activity
protected void onDestroy() {
super.onDestroy();
Log.v(TAG, "Session.onDestroy");
// unregister freerdp events broadcast receiver
unregisterReceiver(libFreeRDPBroadcastReceiver);
// free session
GlobalApp.freeSession(session.getInstance());
session = null;
}
@Override