diff --git a/CefSharp.Wpf/Rendering/InteropBitmapRenderHandler.cs b/CefSharp.Wpf/Rendering/InteropBitmapRenderHandler.cs index 4b4128ac1..57130c317 100644 --- a/CefSharp.Wpf/Rendering/InteropBitmapRenderHandler.cs +++ b/CefSharp.Wpf/Rendering/InteropBitmapRenderHandler.cs @@ -67,6 +67,18 @@ namespace CefSharp.Wpf.Rendering return; } + var size = isPopup ? popupSize : viewSize; + + //If OnPaint is called multiple times before + //our BeginInvoke call we check the size matches our most recent + //update, the buffer has already been overriden (frame is dropped effectively) + //so we ignore this call + //https://github.com/cefsharp/CefSharp/issues/3114 + if (size.Width != width || size.Height != height) + { + return; + } + if (createNewBitmap) { if (image.Source != null) diff --git a/CefSharp.Wpf/Rendering/WritableBitmapRenderHandler.cs b/CefSharp.Wpf/Rendering/WritableBitmapRenderHandler.cs index bc0253ccf..2efe77c1e 100644 --- a/CefSharp.Wpf/Rendering/WritableBitmapRenderHandler.cs +++ b/CefSharp.Wpf/Rendering/WritableBitmapRenderHandler.cs @@ -83,6 +83,18 @@ namespace CefSharp.Wpf.Rendering return; } + var size = isPopup ? popupSize : viewSize; + + //If OnPaint is called multiple times before + //our BeginInvoke call we check the size matches our most recent + //update, the buffer has already been overriden (frame is dropped effectively) + //so we ignore this call + //https://github.com/cefsharp/CefSharp/issues/3114 + if (size.Width != width || size.Height != height) + { + return; + } + if (createNewBitmap) { if (image.Source != null)