mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
IJPL-177883 Fix JBCefBrowser instance leak
GitOrigin-RevId: aa3d2dd96732358ad85cf4e8b697a23252f5e5e6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8a749fe391
commit
6fa5644b46
@@ -5,6 +5,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.jcef.menu.CefContextMenuRunner;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.cef.browser.CefBrowser;
|
||||
import org.cef.handler.CefFocusHandler;
|
||||
import org.cef.handler.CefFocusHandlerAdapter;
|
||||
@@ -112,13 +113,10 @@ public class JBCefBrowser extends JBCefBrowserBase {
|
||||
|
||||
static final @NotNull Dimension DEF_PREF_SIZE = new Dimension(800, 600);
|
||||
|
||||
|
||||
|
||||
private final @NotNull JPanel myComponent;
|
||||
private final @NotNull CefFocusHandler myCefFocusHandler;
|
||||
|
||||
|
||||
private volatile boolean myFirstShow = true;
|
||||
private MessageBusConnection myMsgBusConnection;
|
||||
|
||||
/**
|
||||
* Creates a browser builder.
|
||||
@@ -228,9 +226,8 @@ public class JBCefBrowser extends JBCefBrowserBase {
|
||||
}
|
||||
});
|
||||
|
||||
ApplicationManager.getApplication().getMessageBus()
|
||||
.connect()
|
||||
.subscribe(JBCefHealthMonitor.JBCefHealthCheckTopic.TOPIC,
|
||||
myMsgBusConnection = ApplicationManager.getApplication().getMessageBus().connect();
|
||||
myMsgBusConnection.subscribe(JBCefHealthMonitor.JBCefHealthCheckTopic.TOPIC,
|
||||
new JBCefHealthMonitor.JBCefHealthCheckTopic() {
|
||||
@Override
|
||||
public void onHealthHealthStatusChanged(JBCefHealthMonitor.@NotNull Status status) {
|
||||
@@ -301,6 +298,8 @@ public class JBCefBrowser extends JBCefBrowserBase {
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (myMsgBusConnection != null)
|
||||
myMsgBusConnection.disconnect();
|
||||
super.dispose(() -> {
|
||||
myCefClient.removeFocusHandler(myCefFocusHandler, myCefBrowser);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user