| Summary: | Control#getFont returns disposed font instead of font used by the control | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Ivan Furnadjiev <ivan> |
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | eclipse.felipe, ruediger.herrmann |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 321135 | ||
|
Description
Ivan Furnadjiev
You can not dispose the font that is still being used, some systems the application can crash if yo do that. (In reply to comment #1) > You can not dispose the font that is still being used, some systems the > application can crash if yo do that. This is good news for RWT as it cannot work with disposed fonts either :) The use case described in bug 321135 is: when to dispose of a font (or any other resource) that is used for a specific widget and should be freed 'together' with the widget. Would it be legal to dispose of the font in the widgets dispose event? (In reply to comment #2) > (In reply to comment #1) > > You can not dispose the font that is still being used, some systems the > > application can crash if yo do that. > This is good news for RWT as it cannot work with disposed fonts either :) > The use case described in bug 321135 is: when to dispose of a font (or any > other resource) that is used for a specific widget and should be freed > 'together' with the widget. > Would it be legal to dispose of the font in the widgets dispose event? Usually application store all the resouces they create and release them at the end (after the main event loop returns). See ControlExample for a example. But the answer is yes to your question, you can also use the dispose event of the Display, or just widget.dispose(); font.dispose(); // -> no one else references this font, you created the font explicitely. |