Skip to content

Commit

Permalink
Validate menu and main frame in EDT
Browse files Browse the repository at this point in the history
Do the validations in the EDT to avoid deadlock between bootstrap thread
and EDT.

Fix zaproxy#5526 - ZAP failing to launch on Kali

Signed-off-by: thc202 <thc202@gmail.com>

# Conflicts:
#	zap/src/main/java/org/parosproxy/paros/extension/ExtensionLoader.java

Signed-off-by: Simon Bennetts <psiinon@gmail.com>
  • Loading branch information
thc202 authored and psiinon committed Aug 27, 2019
1 parent f9d9b4b commit 9680517
Showing 1 changed file with 12 additions and 2 deletions.
Expand Up @@ -83,10 +83,13 @@
// ZAP: 2019/03/15 Issue 3578: Added Helper options for Import menu
// ZAP: 2019/06/01 Normalise line endings.
// ZAP: 2019/06/05 Normalise format/style.
// ZAP: 2019/07/25 Relocate null check to be earlier in hookScannerHook(scan) [LGTM issue].
// ZAP: 2019/08/19 Validate menu and main frame in EDT.
package org.parosproxy.paros.extension;

import java.awt.Component;
import java.awt.EventQueue;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
Expand Down Expand Up @@ -920,8 +923,15 @@ public void run() {
}

if (view != null) {
view.getMainFrame().getMainMenuBar().validate();
view.getMainFrame().validate();
try {
EventQueue.invokeAndWait(
() -> {
view.getMainFrame().getMainMenuBar().validate();
view.getMainFrame().validate();
});
} catch (InvocationTargetException | InterruptedException e) {
logger.warn("An error occurred while updating the UI:", e);
}
}
}

Expand Down

0 comments on commit 9680517

Please sign in to comment.