Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRE OnTooltipTimerTick #2134

Closed
xmedeko opened this issue Aug 31, 2017 · 3 comments
Closed

NRE OnTooltipTimerTick #2134

xmedeko opened this issue Aug 31, 2017 · 3 comments
Labels
bug wpf WPF Implementation
Milestone

Comments

@xmedeko
Copy link
Contributor

xmedeko commented Aug 31, 2017

  • What version of the product are you using?
  • Nuget CefSharp.Wpf.57.0.0
  • On what operating system?
    • Win7, Win 8

We have CefSharp embedded in our app (compiled for 32 bit - x86). On our log server arrived two app crashes by:

System.NullReferenceException: Object reference not set to an instance of an object.
at CefSharp.Wpf.ChromiumWebBrowser.OnTooltipTimerTick(Object sender, EventArgs e)
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

I am sorry I do not have more details, the users has not contacted us. It's occurrence is very rare, so I cannot simulate it.

@merceyz merceyz added bug wpf WPF Implementation labels Aug 31, 2017
@merceyz merceyz added this to the 59.0.0 milestone Aug 31, 2017
@merceyz
Copy link
Member

merceyz commented Aug 31, 2017

It seems like a tick happens at the same time as it's disposing, causing tooltipTimer.Stop(); to fail because it's set to null

@xmedeko
Copy link
Contributor Author

xmedeko commented Aug 31, 2017

Thanks for quick fix.
Just advice: if you use Interlocked.CompareExchange as a bool flag often, you may simplify it by some methods like:

public static bool InterlockedIsSet(ref int location1)
    => Interlocked.CompareExchange(ref location1, 0, 0) != 0;

Or, you may wrap it up in some struct InterlockedBool to be even more readable.

@amaitland
Copy link
Member

Or, you may wrap it up in some struct InterlockedBool to be even more readable.

Or you should just check !IsDisposed

https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Wpf/ChromiumWebBrowser.cs#L2286

@amaitland amaitland modified the milestones: 59.0.0, 62.0.0 Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug wpf WPF Implementation
Projects
None yet
Development

No branches or pull requests

3 participants