Fatal error in connection with ToolTip [message #1752595] |
Wed, 25 January 2017 14:12 |
Gunnar Adams Messages: 49 Registered: May 2016 |
Member |
|
|
Hi,
I have been investigating a rather mysterious bug in our application and think, that I have found a potential error in the RAP-Client code.
In the application, we use the Tooltip widget in order to display messages to the user.
We create those tooltips as children of the main application window (a Shell) with the SWT.BALLOON style, setAutHide(false).
When such a tooltip has been displayed by our application, the destruction of the main application window on exit out of the application, will result in an error
Error: Operation "destroy" on target "w2" of type "null" failed:
objectEntry is undefined.
"w2" is the id of the Shell widget being destroyed. The object whose entry is undefined is the ToolTip widget, which has already been disposed by the application a long time before closing the Shell window.
I debugged the Javascript code and found, that the Tooltip widget is added to the destroyableChildren list of the owning Shell, but is never removed from that list when the Tooltip widget is disposed. This is due to the fact that in TooltipHandler.js the protocolParent isn't set. rwt.remote.HandlerUtil.addDestroyableChild(parent, result) is called, though. removeDestroyableChild is never called, because protocolParent is null.
For some reason, for the normal Tooltip behavior displaying hints on/for another widget does not add the ToolTip to the destroyableChildren list.
The following fix to ToolTipHandler.js seems to work fine:
rwt.remote.HandlerRegistry.add( "rwt.widgets.ToolTip", {
factory : function( properties ) {
var styleMap = rwt.remote.HandlerUtil.createStyleMap( properties.style );
var style = null;
if( styleMap.ICON_ERROR ) {
style = "error";
} else if( styleMap.ICON_WARNING ) {
style = "warning";
} else if( styleMap.ICON_INFORMATION ) {
style = "information";
}
var result = new rwt.widgets.ToolTip( style );
result.setMarkupEnabled( properties.markupEnabled === true );
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;
},
Question: is this a bug in RAP or is my usage of the ToolTip widget in this way illegal?
Kind regards,
Gunnar Adams
[Updated on: Wed, 25 January 2017 14:15] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03619 seconds