|
Rank: Newbie Groups: Member
Joined: 5/2/2023 Posts: 2
|
From time to time we get an unhandled NRE. Unfortunately we are not able to reproduce this in a sample app.
All we actually have is the stacktrace.
at EO.Wpf.WebViewHost.oear.Dispose(Boolean disposing) at System.Windows.Interop.HwndHost.Finalize()
Our app constantly adds or removes new EO.Wpf.WebControl instances. Before removing an instance we call WebControl.WebView.Destroy(); WebControl.WebView = null;
Maybe you can give us a hint what is going wrong here or provide an update to handle the NRE in the Dispose method of the WebViewHost.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
This appears to be an issue on our end. Please do NOT explicitly call WebControl.WebView.Destroy() and see if that resolves the issue for you. The WebView will be automatically destroyed when the containing WPF window is destroyed, as such there is no need to call WebView.Destroy explicitly.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/2/2023 Posts: 2
|
Waiting for automatic cleanup is not an option. As the owner window may never closes.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, Please call the WebControl's Dispose instead. For example, in the TabbedBrowser sample application you can do something like this when a tab is closed:
Code: C#
//Get the object that contains information about a tab
WebViewItem item = (WebViewItem)m_WebViewsHost.Items[index];
//Remove the tab from the visual tree
m_WebViewsHost.Items.RemoveAt(index);
//Call WebControl's Destroy method. This will destroy the WebView
item.Page.WebControl.Destroy();
The key is do not touch WebControl.WebView. Thanks!
|
|