fix(legacy): release hosted module resources safely
This commit is contained in:
@@ -126,6 +126,7 @@ namespace Lskj.Control.Model
|
||||
// 控件,不调用 Control.Dispose,也不扫描全局控件集合,因而
|
||||
// 不会影响仍然打开的模块或共享的 GridView 生命周期。
|
||||
ReleaseGridControlRuntimeReferences(moduleControls);
|
||||
ReleaseLookupControlRuntimeReferences(moduleControls);
|
||||
|
||||
foreach (GridView gridView in gridViews)
|
||||
{
|
||||
@@ -204,6 +205,33 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReleaseLookupControlRuntimeReferences(
|
||||
IEnumerable<WinFormsControl> moduleControls)
|
||||
{
|
||||
if (moduleControls == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Lskj.Control.LabelMultiAutoTextEdit4 lookupControl in
|
||||
moduleControls.OfType<Lskj.Control.LabelMultiAutoTextEdit4>())
|
||||
{
|
||||
if (lookupControl == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lookupControl.ReleaseLookupFormForDispose();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
TraceCleanupFailure("release lookup helper form", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<WinFormsControl> CollectModuleControls(
|
||||
WinFormsControl moduleRoot,
|
||||
XtraTabPage modulePage)
|
||||
|
||||
Reference in New Issue
Block a user