Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343059 - Check for UIThread in Graphics#getXXX methods
Summary: Check for UIThread in Graphics#getXXX methods
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 1.5 M1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 341763
  Show dependency tree
 
Reported: 2011-04-17 06:28 EDT by Rüdiger Herrmann CLA
Modified: 2011-07-01 09:28 EDT (History)
0 users

See Also:


Attachments
Proposed fix (5.80 KB, patch)
2011-04-17 07:03 EDT, Rüdiger Herrmann CLA
no flags Details | Diff
Proposed fix v2 (11.76 KB, patch)
2011-06-07 07:17 EDT, Rüdiger Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.