fix: 收敛旧模块资源释放与诊断

This commit is contained in:
2026-08-15 10:13:08 +08:00
parent 222ae3c08a
commit c49015d390
60 changed files with 4218 additions and 409 deletions
@@ -42,7 +42,7 @@ namespace Lskj.Control.BrowserSetting
}
if (BsClient != null && BsClient.frmWebBrowser != null && BsClient.frmWebBrowser.Parent != null && BsClient.frmWebBrowser.Parent.Name.Equals("previewFrm"))
{
browser.GetHost().CloseBrowser();
BsClient.frmWebBrowser.CloseBrowser();
}
else if (BsClient != null && BsClient.frmWebBrowser != null)
{
@@ -196,11 +196,24 @@ namespace Lskj.Control.BrowserSetting
try
{
if (browser == null) return null;
IntPtr browserHandle = browser.GetHost().GetWindowHandle();
IntPtr browserHandle;
using (var browserHost = browser.GetHost())
{
browserHandle = browserHost.GetWindowHandle();
}
if (browserHandle == IntPtr.Zero) return null;
IntPtr parentHandle = GetParent(browserHandle);
if (parentHandle == IntPtr.Zero) return null;
System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle(parentHandle);
System.Windows.Forms.Control control = null;
while (parentHandle != IntPtr.Zero && control == null)
{
// The CEF child now sits inside an application-owned native
// host. Walk through that host to preserve the original
// FrmWebBrowser-based module lookup.
control = System.Windows.Forms.Control.FromHandle(parentHandle);
parentHandle = GetParent(parentHandle);
}
if (control == null) return null;
if (control != null && control.Parent != null && control.Parent.Parent != null)
{