| Summary: | [TextSizeDetermination] fails with disposed fonts | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Benjamin Muskalla <b.muskalla> | ||||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||||
| Status: | RESOLVED WONTFIX | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | ||||||||
| Version: | 1.3 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Benjamin Muskalla
Created attachment 157388 [details]
testcase
Here is a testcase which shows the behavior for the Table widget.
Another problem related to this is that Probes that are stored by the TSD can be disposed before the TSD kicks in.
Example:
Display display = new Display();
Shell shell = new Shell( display );
shell.setLayout( new GridLayout( 1, false ) );
Label label = new Label( shell, SWT.NONE );
label.setText("sdjfdsjfh");
final Font font = new Font(display, "foo", 10, SWT.BOLD);
label.setFont( font );
display.addListener( SWT.Dispose, new Listener() {
public void handleEvent( Event event ) {
font.dispose();
}
});
shell.pack();
shell.open();
while( !shell.isDisposed() ) {
if( !display.readAndDispatch() )
display.sleep();
}
display.dispose();
return 0;
Run the snippet and reload the page. The disposed font is still in the queue of the TSD but already disposed which leads to the following exception:
org.eclipse.swt.SWTException: Graphic is disposed
at org.eclipse.swt.SWT.error(SWT.java:2757)
at org.eclipse.swt.SWT.error(SWT.java:2677)
at org.eclipse.swt.SWT.error(SWT.java:2648)
at org.eclipse.swt.graphics.Font.getFontData(Font.java:168)
at org.eclipse.swt.internal.graphics.TextSizeProbeStore.createProbeResult(TextSizeProbeStore.java:104)
at org.eclipse.swt.internal.graphics.TextSizeDeterminationHandler.readProbedFonts(TextSizeDeterminationHandler.java:177)
at org.eclipse.swt.internal.graphics.TextSizeDetermination.readStartupProbes(TextSizeDetermination.java:169)
at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:252)
at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:117)
at java.lang.Thread.run(Thread.java:619)
at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:80)
Created attachment 157625 [details]
Another test case
The snippet from the description now works (with bug 301249 fixed) Regarding the attached test case (Table_Test#testDisposedFont) I am not sure if this is a valid use case. Even though SWT seems to gracefully handle this situation, disposing of a font that is still in use looks more like a programming error to me. After gathering some more feedback I will close this bug as WONTFIX. Even though SWT seems to handle disposed fonts somehow, it is certainly not considered a valid use case (for RWT at least) |