diff --git a/plugins/WebViewObject.cs b/plugins/WebViewObject.cs index 8cc52171..8ed174fa 100644 --- a/plugins/WebViewObject.cs +++ b/plugins/WebViewObject.cs @@ -458,6 +458,13 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative = if (webView == null) return; #endif + if (mMarginLeft == left + && mMarginTop == top + && mMarginRight == right + && mMarginBottom == bottom) + { + return; + } mMarginLeft = left; mMarginTop = top; mMarginRight = right; @@ -1023,11 +1030,13 @@ void Update() textureDataBuffer = new byte[w * h * 4]; } } - var gch = GCHandle.Alloc(textureDataBuffer, GCHandleType.Pinned); - _CWebViewPlugin_Render(webView, gch.AddrOfPinnedObject()); - gch.Free(); - texture.LoadRawTextureData(textureDataBuffer); - texture.Apply(); + if (textureDataBuffer.Length > 0) { + var gch = GCHandle.Alloc(textureDataBuffer, GCHandleType.Pinned); + _CWebViewPlugin_Render(webView, gch.AddrOfPinnedObject()); + gch.Free(); + texture.LoadRawTextureData(textureDataBuffer); + texture.Apply(); + } } }