嗨,我已将我的应用程序从45升级到Cefsharp 71版,较早创建的新选项卡很容易处理(删除),但是现在整个应用程序都关闭了,当我使用remove方法时,该选项卡关闭了,但仍保留导致系统挂起的内存。
public void AddNewBrowserTab(string url, int? insertIndex = null) {
browserTabControl.SuspendLayout();
var browser = new BrowserTabUserControl(AddNewBrowserTab, url, UserName, pass, browserTabControl, txtUName.Text.ToString().Trim(), txtUPassword.Text.ToString().Trim(), MUser, TUser);
var tabPage = new TabPage(url);
browser.CreateControl();
tabPage.Controls.Add(browser);
if (insertIndex == null) {
browserTabControl.TabPages.Add(tabPage);
} else {
browserTabControl.TabPages.Insert(insertIndex.Value, tabPage);
}
browserTabControl.SelectedTab = tabPage;
browserTabControl.ResumeLayout(true);
}
//Call Method
public BrowserTabUserControl(Action<string, int?> openNewTab, string url, string uname, string pwd, TabControl browserTabControl, string loginUsrname, string LoginUsrpwd, string muser, string thuser) {
InitializeComponent();
MonsterUsr = monsteruser;
Techfetchuser = techfetchuser;
loginUsername = loginUsrname;
name = uname;
passwd = pwd;
txtuname = loginUsrname;
txtupwd = LoginUsrpwd;
browserTabControls = browserTabControl;
var browser = new ChromiumWebBrowser(url) {
Dock = DockStyle.Fill
};
var userControl = new UserControl { Dock = DockStyle.Fill };
ZoomIn.Controls.Add(browser);
Browser = browser;
browser.MenuHandler = new MenuHandler();
browser.JsDialogHandler = new JsDialogHandler();
browser.AddressChanged += Browser_AddressChanged;
browser.DownloadHandler = new DownloadHandler(browserTabControl);
browser.LifeSpanHandler = new LifeSpanHandler(browserTabControl, ref Browser, loginUsrname, LoginUsrpwd);
browser.KeyboardHandler = new KeyboardHandler();
}