Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2017-01-26 11:51:28 +0000
committerIvan Furnadjiev2017-01-26 11:51:28 +0000
commit2e46d3d16f129d0e8e787e8ca350385f7c947f8d (patch)
tree5ef2da7b9cc4be9068b51412cc5fb06241c841bd
parentade9df34ede9dc9f48209259d814e9ec414bb7ad (diff)
downloadorg.eclipse.rap-2e46d3d16f129d0e8e787e8ca350385f7c947f8d.tar.gz
org.eclipse.rap-2e46d3d16f129d0e8e787e8ca350385f7c947f8d.tar.xz
org.eclipse.rap-2e46d3d16f129d0e8e787e8ca350385f7c947f8d.zip
Fix client crash on ToolTip parent disposal
The Tooltip widget is added to the destroyableChildren list of its parent in ToolTipHandler.js, but it's never removed as "protocolParent" is not set (see HandlerUtil.js#_widgetDestructor). When disposing the ToolTip widget first and then its parent, a client crash occures, because the disposed (removed from ObjectRegistry) ToolTip is still available in the destroyableChildren list. Set ToolTip "protocolParent" user data in ToolTipHandler. 511037: Error due to explicit creation of a ToolTip widget https://bugs.eclipse.org/bugs/show_bug.cgi?id=511037 Change-Id: I3b42ac516b20cbcc3dbd5d1d46e45e2610ebbe53
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ToolTipHandler.js3
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ToolTipTest.js15
2 files changed, 16 insertions, 2 deletions
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ToolTipHandler.js b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ToolTipHandler.js
index ac0a62a220..1fb8d9c456 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ToolTipHandler.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ToolTipHandler.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 EclipseSource and others.
+ * Copyright (c) 2011, 2017 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,6 +26,7 @@ rwt.remote.HandlerRegistry.add( "rwt.widgets.ToolTip", {
rwt.remote.HandlerUtil.addStatesForStyles( result, properties.style );
rwt.remote.HandlerUtil.callWithTarget( properties.parent, function( parent ) {
rwt.remote.HandlerUtil.addDestroyableChild( parent, result );
+ result.setUserData( "protocolParent", parent );
} );
return result;
},
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ToolTipTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ToolTipTest.js
index 1c7862c04f..1e4e494e1a 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ToolTipTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ToolTipTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 EclipseSource and others.
+ * Copyright (c) 2011, 2017 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -64,6 +64,19 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.ToolTipTest", {
assertTrue( widget.isDisposed() );
},
+ testDestroyToolTipBeforeParent : function() {
+ var shell = TestUtil.createShellByProtocol( "w2" );
+ var widget = this._createToolTipByProtocol( "w3", "w2", [ "BALLOON" ] );
+
+ Processor.processOperationArray( [ "destroy", "w3"] );
+ TestUtil.flush();
+ Processor.processOperationArray( [ "destroy", "w2"] );
+ TestUtil.flush();
+
+ assertTrue( shell.isDisposed() );
+ assertTrue( widget.isDisposed() );
+ },
+
testCreateToolTipWithIconErrorByProtocol : function() {
var shell = TestUtil.createShellByProtocol( "w2" );
var widget = this._createToolTipByProtocol( "w3", "w2", [ "BALLOON", "ICON_ERROR" ] );

Back to the top