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

Bug 343059

Summary: Check for UIThread in Graphics#getXXX methods
Product: [RT] RAP Reporter: Rüdiger Herrmann <ruediger.herrmann>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: 1.5 M1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 341763    
Attachments:
Description Flags
Proposed fix
none
Proposed fix v2 none

Description Rüdiger Herrmann CLA 2011-04-17 06:28:55 EDT
It only makes sense to call these methods from the UIThread. We should add a check to enforce this restriction.

When done, the extra check for display.getThread() == Thread.currentThread() can be removed from TextSizeDeterminationHandler#register()
Comment 1 Rüdiger Herrmann CLA 2011-04-17 07:03:38 EDT
Created attachment 193431 [details]
Proposed fix

Inserts a call to checkThread() at the beginning of each of the public methods.
checkThread() only succeeds if there is a current display and its thread is the same as the current thread; otherwise an SWTException is thrown.
Comment 2 Rüdiger Herrmann CLA 2011-06-07 07:17:46 EDT
Created attachment 197489 [details]
Proposed fix v2

Synced first patch with HEAD
Comment 3 Rüdiger Herrmann CLA 2011-07-01 09:28:17 EDT
The getXXX methods from Graphics now throw an SWTException if accessed from a non-UI-thread
Changes are in CVS HEAD.