Closed oconnor663 closed 12 years ago
Yeah, good find. We should probably block JS execution once Dispose begins.
On , Jack O'Connor
reply@reply.github.com
wrote:
> CefSharp.dll!CefSharp::ScriptCore::UIT_Execute(CefRefPtr* browser, CefStringBase* script) Line 10 C++ [External Code] CefSharp.dll!DispatchToMethod,CefStringBase),CefRefPtr,CefStringBase >(CefSharp::ScriptCore* obj, void* method, Tuple2,CefStringBase >& arg) Line 592 C++ CefSharp.dll!CefRunnableMethod,CefStringBase),Tuple2,CefStringBase > >::Execute(cef_thread_id_t threadId) Line 151 C++ [External Code]
This occurs when an ExecuteScript call is made right before the app
exits, so presumably the WinForms browser is getting disposed out from
under us. Is there a good way to protect ourselves from this error?
Alternatively, should we do something like check for null here in
UIT_Execute?
Reply to this email directly or view it on GitHub:
On second though, we probably need something more similar to the TryGetCefBrowser() pattern used within the WebView classes:
https://github.com/ataranto/CefSharp/blob/master/CefSharp.Wpf/WebView.cpp#L42
Working from your suggestion, this looks like it solves the problem. How does it look to you?
https://github.com/oconnor663/CefSharp/commit/e595b4ff1dccc73d90ad24cdf96b291fb7e13d9c
Yeah, looks great. I may try to make a general TryGet* internal api. Also, I might make Evaluate throw an exception, which right now is how consumers are notified that "your script didn't run successfully" .
Do you want to merge the diff as it is now, or make changes first?
I will probably merge it as is for now. I want to make some time this weekend to merge in a bunch of contributions and make a release, there are lots of great changes/fixes that are only on other people's branches right now, so i want to get them merged before there's more fragmentation.
This occurs when an ExecuteScript call is made right before the app exits, so presumably the WinForms browser is getting disposed out from under us. Is there a good way to protect ourselves from this error? Alternatively, should we do something like check for null here in UIT_Execute?