Revision bd4b36be
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/library/main/DistortedMaster.java | ||
---|---|---|
53 | 53 |
Slave slave; |
54 | 54 |
int num = mSlaves.size(); |
55 | 55 |
|
56 |
for(int i=0; i<num; i++)
|
|
56 |
try
|
|
57 | 57 |
{ |
58 |
slave = mSlaves.remove(0); |
|
59 |
slave.doWork(); |
|
58 |
for(int i=0; i<num; i++) |
|
59 |
{ |
|
60 |
slave = mSlaves.remove(0); |
|
61 |
slave.doWork(); |
|
62 |
} |
|
63 |
} |
|
64 |
catch(IndexOutOfBoundsException ie) |
|
65 |
{ |
|
66 |
// onDestroy must have been called, ignore |
|
60 | 67 |
} |
61 | 68 |
|
62 | 69 |
return ( num>0 ); |
... | ... | |
70 | 77 |
boolean found = false; |
71 | 78 |
Slave tmp; |
72 | 79 |
|
73 |
for(int i=0; i<num; i++)
|
|
80 |
try
|
|
74 | 81 |
{ |
75 |
tmp = mSlaves.get(i); |
|
76 |
|
|
77 |
if( tmp==s ) |
|
82 |
for(int i=0; i<num; i++) |
|
78 | 83 |
{ |
79 |
found = true; |
|
80 |
break; |
|
84 |
tmp = mSlaves.get(i); |
|
85 |
|
|
86 |
if( tmp==s ) |
|
87 |
{ |
|
88 |
found = true; |
|
89 |
break; |
|
90 |
} |
|
81 | 91 |
} |
82 | 92 |
} |
93 |
catch(IndexOutOfBoundsException ie) |
|
94 |
{ |
|
95 |
// onDestroy must have been called, ignore |
|
96 |
} |
|
83 | 97 |
|
84 | 98 |
if( !found ) mSlaves.add(s); |
85 | 99 |
} |
Also available in: Unified diff
Avoid a potential crash on exit