Android: Fixed possible crash with a session being null
This commit is contained in:
parent
50c94186e8
commit
6b48a8c7c5
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user