Cleaned up removing menu entry, added exception throwing

This commit is contained in:
nathan 2016-09-26 21:46:41 +02:00
parent 19eb4df547
commit 180d66a7c1

View File

@ -1181,22 +1181,26 @@ class SystemTray {
@Override @Override
public public
void run() { void run() {
synchronized (menuEntries) { try {
for (Iterator<MenuEntry> iterator = menuEntries.iterator(); iterator.hasNext(); ) { synchronized (menuEntries) {
final MenuEntry entry = iterator.next(); for (Iterator<MenuEntry> iterator = menuEntries.iterator(); iterator.hasNext(); ) {
if (entry.getText() final MenuEntry entry = iterator.next();
.equals(label)) { if (entry.getText()
iterator.remove(); .equals(label)) {
iterator.remove();
// this will also reset the menu // this will also reset the menu
menuEntry.remove(); menuEntry.remove();
hasValue.set(true); hasValue.set(true);
countDownLatch.countDown(); break;
return; }
} }
} }
} catch (Exception e) {
logger.error("Error removing menu entry from list.", e);
} finally {
countDownLatch.countDown();
} }
countDownLatch.countDown();
} }
}); });