Skip to content

Commit 250bc1b

Browse files
committed
[platform] fixbug: crash on close for HashMap
- for (x : HashMap.keySet()) then remove x in for loop
1 parent f42650c commit 250bc1b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/app/src/main/java/seven/drawalive/nodebase/NodeBase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ protected void onCreate(Bundle savedInstanceState) {
4444
@Override
4545
protected void onDestroy() {
4646
Permission.keepScreen(this, false);
47+
// if want to keep service running in backend
48+
// comment out this line and add "Stop Service" somewhere
4749
NodeService.stopService(this);
4850
super.onDestroy();
4951
}

app/app/src/main/java/seven/drawalive/nodebase/NodeService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ public void onDestroy() {
120120
}
121121

122122
private void stopNodeApps() {
123-
for(String name : services.keySet()) {
123+
int n = services.keySet().size();
124+
String[] keys = new String[n];
125+
services.keySet().toArray(keys);
126+
for(String name : keys) {
124127
stopNodeApp(name);
125128
}
126129
}

0 commit comments

Comments
 (0)