| Summary: | SWT Exception when accessing the gc within a paint listener | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Holger Staudacher <holger.staudacher> | ||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | critical | ||||||
| Priority: | P3 | CC: | rsternberg | ||||
| Version: | 2.0 | ||||||
| Target Milestone: | 2.0 M3 | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Holger Staudacher
Created attachment 223304 [details]
Testcase to reproduce
The test is not so correct. In the Canvas ctor there is a repaint() call that trigger the SWT.Paint event. Normally, widget creation is done into a PROCESS_ACTION phase. Thus, the SWT.Paint event is executed immediately. In the test case the phase is not specified and the event is put into the queue. When it's time to execute it (by executeLifeCycleFromServerThread()) the GC is already disposed (see Canvas#repaint()). The correct test case should have Fixture.fakePhase( PhaseId.PROCESS_ACTION ); in the beginning. Thanks Ivan for the explanation. But why did it worked with RAP 2.0 M1 and earlier? Fixed with commit 30168c469b7713ee8b31d277e31a932ba0ec98dc. The Canvas constructor unnecessarily called repaint(). This call was useless, because during initialization, gcAdapter is null and there aren't any listeners attached yet. But calling this method created an event that was later being executed in ProcessAction. Before the event system rewrite, this has probably been prevented by EventUtil.isAccessible(). Recently, we reworked the event system in RAP (see bug 334028). Before, there was a null check for the phase in the TypedEvent#processEvent(). After the event system rework this code is completely gone as this should never happen in the real world. (In reply to comment #5) > Recently, we reworked the event system in RAP (see bug 334028). Before, > there was a null check for the phase in the TypedEvent#processEvent(). After > the event system rework this code is completely gone as this should never > happen in the real world. Ah, that explains it. Completely agree that the error could only occur in a test. However, the test case looks valid to me and the exception should not happen. |