Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315060

Summary: 'Widget is disposed'-Exception when using DefaultButtons
Product: [RT] RAP Reporter: Stefan Hansel <stefan.hansel>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: Daniel.Ebert
Version: 1.3   
Target Milestone: 1.3 RC3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Code to reproduce the error
none
Stacktrace
none
Proposed Fix ruediger.herrmann: review+

Description Stefan Hansel CLA 2010-05-31 07:22:14 EDT
Created attachment 170512 [details]
Code to reproduce the error

We have a problem with RAP 1.3M3 (also still reproducable with RAP1.3RC2).
The problem described here doesn't exist in RAP 1.2.1 and currently prevents upgrading to the latest RAP version.

We have an UI containing a DefaultButton. Later on this UI (including the Button) gets disposed and replaced by a new UI. 
TextLCAUtil then runs into a "Widget is disposed"-Exception for that Button.

Attached you will find the Stacktrace along with a small sample where you should easily be able to reproduce the problem.
The Exception only comes, when the new UI contains a TextField.
Comment 1 Stefan Hansel CLA 2010-05-31 07:23:09 EDT
Created attachment 170513 [details]
Stacktrace
Comment 2 Ralf Sternberg CLA 2010-05-31 11:51:11 EDT
Created attachment 170544 [details]
Proposed Fix

The problem is that Shell#getDefaultButton() returns a disposed Button instance. This is not the case in SWT. This patch changes this method to return null if the registered default button has been disposed.
Comment 3 Ralf Sternberg CLA 2010-06-01 04:07:12 EDT
Committed the patch to CVS HEAD.