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 #5526 - ZAP failing to launch on Kali

Signed-off-by: thc202 <thc202@gmail.com>
  • Loading branch information
thc202 committed Aug 19, 2019
1 parent 6dc5f18 commit 9eb6de0
Showing 1 changed file with 12 additions and 3 deletions.
Expand Up @@ -83,11 +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: 019/07/25: Relocate null check to be earlier in hookScannerHook(scan) [LGTM issue].
// 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 @@ -922,8 +924,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 9eb6de0

Please sign in to comment.