Bug 274716 - TreeSelection is no longer posted to server if selected TreeItem disposed
Summary: TreeSelection is no longer posted to server if selected TreeItem disposed
Status: RESOLVED INVALID
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2009-05-01 23:03 EDT by Vaughn CLA
Modified: 2009-09-07 08:53 EDT (History)
1 user (show)

See Also:


Attachments
Updated TreeItemUtil.js (2.63 KB, application/x-javascript)
2009-05-01 23:03 EDT, Vaughn CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vaughn CLA 2009-05-01 23:03:49 EDT
Created attachment 134143 [details]
Updated TreeItemUtil.js

Environment: Firefox 3/Internet Explorer 7/RAP 1.2M6

Steps to reproduce:
1.  Create a Tree widget (Note: not a TreeViewer) and populate with some TreeItems
2.  Select one of the items
3.  Remove the selected item and replace with another TreeItem

Once this happens, selection is no longer posted to the server and getSelection returns an empty array even when items are selected in the browser.

I have traced through the code and found the problem to be in the following file from org.eclipse.rap.rwt.q07_1.2.0.20090319-1159.jar:
org/eclipse/swt/TreeItemUtil.js

hijackTreeItemSelection should check if the TreeItem is disposed as follows:

hijackTreeItemSelection : function( item ) {
      item._applySelected = function(value, old)
        {
          // Ensure item is not disposed
          if (this.isDisposed())
               return;
          if (value)
          {
            this.addState("selected");
            this._labelObject.addState("selected");
          }
          else
          {
            this.removeState("selected");
            this._labelObject.removeState("selected");
        }

... etc
Comment 1 Ivan Furnadjiev CLA 2009-05-14 10:55:55 EDT
Vaughn, recently we fixed several bugs (bug 244952 and bug 266762) related to the tree widget. Can you check this issue against CVS HEAD. With CVS HEAD I can't reproduce what you described. If the bug persist please attach a snippet that demonstrate the bug.
Comment 2 Vaughn CLA 2009-05-14 21:10:53 EDT
Hi Ivan,

As requested, I checked out the CVS HEAD code and ran against it.  Unfortunately the problem still persists in my application (unless I make the code change I've previously attached).

That said, I can't seem to be able to come up with a snippet that will reproduce the error.  The actual code causing the problem is somewhat complex to post here as a snippet.  I've tried to reproduce using the same elements my actual application code uses (background Jobs to update the tree, Display.asyncExec calls, Multiple listeners attached), but with no luck.

With my application code, the bug is 100% reproducible, however, I have a fix so it is not a problem for me.  Not sure if anyone else has seen this issue.
Comment 3 Ivan Furnadjiev CLA 2009-09-07 08:53:24 EDT
Without a snippet we can't do much about it. Please reopen it if you have a snippet to reproduce it.