From 97a3413ddf702197ab9ddb86489d6f5d9a991a03 Mon Sep 17 00:00:00 2001 From: 1zuna Date: Tue, 12 Mar 2024 02:12:27 +0100 Subject: [PATCH] fix shutdown concurrent modification issue fixes https://github.com/CCBlueX/LiquidBounce/issues/2238 --- java/org/cef/CefClient.java | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/java/org/cef/CefClient.java b/java/org/cef/CefClient.java index cb3a58c7..f34d1c83 100644 --- a/java/org/cef/CefClient.java +++ b/java/org/cef/CefClient.java @@ -4,45 +4,22 @@ package org.cef; -import org.cef.browser.CefBrowser; -import org.cef.browser.CefBrowserFactory; -import org.cef.browser.CefFrame; -import org.cef.browser.CefMessageRouter; -import org.cef.browser.CefRequestContext; -import org.cef.callback.CefAuthCallback; -import org.cef.callback.CefBeforeDownloadCallback; -import org.cef.callback.CefCallback; -import org.cef.callback.CefContextMenuParams; -import org.cef.callback.CefDownloadItem; -import org.cef.callback.CefDownloadItemCallback; -import org.cef.callback.CefDragData; -import org.cef.callback.CefFileDialogCallback; -import org.cef.callback.CefJSDialogCallback; -import org.cef.callback.CefMenuModel; -import org.cef.callback.CefPrintDialogCallback; -import org.cef.callback.CefPrintJobCallback; +import org.cef.browser.*; +import org.cef.callback.*; import org.cef.handler.*; import org.cef.misc.BoolRef; import org.cef.misc.CefAudioParameters; import org.cef.misc.CefPrintSettings; -import org.cef.misc.StringRef; import org.cef.network.CefRequest; import org.cef.network.CefRequest.TransitionType; -import org.cef.network.CefResponse; -import org.cef.network.CefURLRequest; - -import java.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; + +import java.awt.*; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Vector; -import javax.swing.SwingUtilities; - /** * Client that owns a browser and renderer. */ @@ -511,7 +488,8 @@ private void cleanupBrowser(int identifier) { browser_.remove(identifier); } else if (!browser_.isEmpty()) { // Close all browsers. - Collection browserList = browser_.values(); + Collection browserList = new ArrayList<>(browser_.values()); + for (CefBrowser browser : browserList) { browser.close(true); }