Welcome Guest Search | Active Topics | Sign In | Register

RegisterJSExtensionFunction, removing handler Options
Eurice
Posted: Friday, April 8, 2016 6:13:42 AM
Rank: Advanced Member
Groups: Member

Joined: 12/10/2014
Posts: 137
Hello guys,

Im registering a javascript extension like this :
webViewEO.RegisterJSExtensionFunction("actionJSCallibri", new JSExtInvokeHandler(WebView_JSAction));

In the documentation we can read "webView1.RegisterJSExtensionFunction("demoAbout", new JSExtInvokeHandler(WebView_JSDemoAbout))"

But there is no documentation on how to remove this handler, so I tryed the following :

webViewEO.RegisterJSExtensionFunction -= new JSExtInvokeHandler(WebView_JSAction);


But it seems that's not working.
I was profiling my app and saw that after closing the webview :





The handler is still there and my memory profiler app indicate "... have instances that are directly rooted by a delegate. This can indicate that the delegate has not been properly removed."

Is it normal or I do need to perform some action to close this handle ?

Best regards
Eurice
Posted: Friday, April 8, 2016 6:24:02 AM
Rank: Advanced Member
Groups: Member

Joined: 12/10/2014
Posts: 137
By the way I found 2 another suspicious handler remaining after closing a webview which I believe are internally opened :

"GiveFocusHandler" and "WndMsgEventHandler"




I'm using the lastest 2015 version
eo_support
Posted: Friday, April 8, 2016 12:49:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You can use RegisterJSExtensionFunction("actionJSCallibri", null) to remove the extension handler.

The GiveFocusHandler and WndMsgEventHandler is used by the WebControl wrapper class. Just destroying the WebView will not disconnect these two handlers. Setting WebControl.WebView to null should disconnect them. However even if it is not disconnected, as soon as the WebControl is destroyed, all of them will be eligible for garbage collection. So it should not be an issue.

Thanks!
Eurice
Posted: Monday, April 11, 2016 3:12:51 AM
Rank: Advanced Member
Groups: Member

Joined: 12/10/2014
Posts: 137
Hey,

It's perfect now thanks :)
eo_support
Posted: Monday, April 11, 2016 9:50:31 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Glad to hear that it works for you! Please feel free to let us know if there is anything else.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.