Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2017-03-20 14:08:37 +0000
committerLeo Ufimtsev2017-03-20 14:10:30 +0000
commit95aee4d875873e0a962f582c45b052bd8ef741c5 (patch)
tree108ea81e84e4a93da7b6c502ec35eb3f1f585ce1
parent8c114e75715b38aa6740a659e9bf1a12396fea1f (diff)
downloadeclipse.platform.swt-95aee4d875873e0a962f582c45b052bd8ef741c5.tar.gz
eclipse.platform.swt-95aee4d875873e0a962f582c45b052bd8ef741c5.tar.xz
eclipse.platform.swt-95aee4d875873e0a962f582c45b052bd8ef741c5.zip
Bug 513837: [Webkit2] Occasional crash on libjavascriptcoregtk-4.0.so
during gtk_widget_destroy Crash is not reproducible, so I have to statically determine root cause and submit patch(es) based on what I think could cause the crash. Suspicion 1: Webkit1 external object - @ Guarding off webkit1 logic that injected/freed a javascript object. This logic is not used by Webkit2, OS.free() is hazardous. - A crash occurs during javascript executing when disposing a widget, I have the feeling that the OS.free() could free up memory that might get re-freed after and causing a crash. Change-Id: Idb878371d2d0d722c3a376bb4b95cbc43df22b24 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=513837 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index 43cf74618f..b4500b672a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -28,7 +28,11 @@ import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
class WebKit extends WebBrowser {
- long /*int*/ webView, webViewData, scrolledWindow;
+ long /*int*/ webView, scrolledWindow;
+
+ /** Webkit1 only. Used by the externalObject for javascript callback to java. */
+ long /*int*/ webViewData;
+
int failureCount, lastKeyCode, lastCharCode;
String postData;
String[] headers;
@@ -793,8 +797,10 @@ public void create (Composite parent, int style) {
webView = WebKitGTK.webkit_web_view_new ();
}
- webViewData = C.malloc (C.PTR_SIZEOF);
- C.memmove (webViewData, new long /*int*/[] {webView}, C.PTR_SIZEOF);
+ if (!WEBKIT2) {
+ webViewData = C.malloc (C.PTR_SIZEOF);
+ C.memmove (webViewData, new long /*int*/[] {webView}, C.PTR_SIZEOF);
+ }
if (!WEBKIT2){
OS.gtk_container_add (scrolledWindow, webView);
@@ -1928,12 +1934,15 @@ void onDispose (Event e) {
}
functions = null;
- if (eventFunction != null) {
- eventFunction.dispose (false);
- eventFunction = null;
+ if (!WEBKIT2) {
+ // event function/external object only used by webkit1. For Webkit2, see Webkit2JavaCallback
+ if (eventFunction != null) {
+ eventFunction.dispose (false);
+ eventFunction = null;
+ }
+ C.free (webViewData);
}
- C.free (webViewData);
postData = null;
headers = null;
htmlBytes = null;

Back to the top