aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/org/connectbot/PortForwardListActivity.java
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2015-09-07 22:15:57 -0700
committerKenny Root <kenny@the-b.org>2015-09-07 22:15:57 -0700
commit57afa9bdc5b269a48bd27fc8455cab4cb956d02a (patch)
tree86e301f6769a92bf853e8d60b156a4e98f077ecf /app/src/main/java/org/connectbot/PortForwardListActivity.java
parent747e11c6ff28fc833855b9979ce68a15b99915f6 (diff)
downloadconnectbot-57afa9bdc5b269a48bd27fc8455cab4cb956d02a.tar.gz
connectbot-57afa9bdc5b269a48bd27fc8455cab4cb956d02a.tar.bz2
connectbot-57afa9bdc5b269a48bd27fc8455cab4cb956d02a.zip
Never cache instances of the HostDatabase
Diffstat (limited to 'app/src/main/java/org/connectbot/PortForwardListActivity.java')
-rw-r--r--app/src/main/java/org/connectbot/PortForwardListActivity.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/app/src/main/java/org/connectbot/PortForwardListActivity.java b/app/src/main/java/org/connectbot/PortForwardListActivity.java
index b0f835d..408e194 100644
--- a/app/src/main/java/org/connectbot/PortForwardListActivity.java
+++ b/app/src/main/java/org/connectbot/PortForwardListActivity.java
@@ -68,8 +68,6 @@ public class PortForwardListActivity extends ListActivity {
private static final int LISTENER_CYCLE_TIME = 500;
- protected HostDatabase hostdb;
-
private List<PortForwardBean> portForwards;
private ServiceConnection connection = null;
@@ -83,8 +81,6 @@ public class PortForwardListActivity extends ListActivity {
super.onStart();
this.bindService(new Intent(this, TerminalManager.class), connection, Context.BIND_AUTO_CREATE);
-
- hostdb = HostDatabase.get(this);
}
@Override
@@ -92,8 +88,6 @@ public class PortForwardListActivity extends ListActivity {
super.onStop();
this.unbindService(connection);
-
- hostdb = null;
}
@Override
@@ -105,7 +99,7 @@ public class PortForwardListActivity extends ListActivity {
setContentView(R.layout.act_portforwardlist);
// connect with hosts database and populate list
- this.hostdb = HostDatabase.get(this);
+ HostDatabase hostdb = HostDatabase.get(this);
host = hostdb.findHostById(hostId);
{
@@ -342,6 +336,7 @@ public class PortForwardListActivity extends ListActivity {
if (hostBridge != null)
hostBridge.removePortForward(pfb);
+ HostDatabase hostdb = HostDatabase.get(PortForwardListActivity.this);
hostdb.deletePortForward(pfb);
} catch (Exception e) {
Log.e(TAG, "Could not delete port forward", e);
@@ -368,8 +363,8 @@ public class PortForwardListActivity extends ListActivity {
if (hostBridge != null) {
this.portForwards = hostBridge.getPortForwards();
} else {
- if (this.hostdb == null) return;
- this.portForwards = this.hostdb.getPortForwardsForHost(host);
+ HostDatabase hostdb = HostDatabase.get(this);
+ this.portForwards = hostdb.getPortForwardsForHost(host);
}
PortForwardAdapter adapter = new PortForwardAdapter(this, portForwards);