Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346859 - StatusMeter fails to free window handles
Summary: StatusMeter fails to free window handles
Status: RESOLVED FIXED
Alias: None
Product: Riena
Classification: RT
Component: UI (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Thorsten Schenkel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 346670
  Show dependency tree
 
Reported: 2011-05-23 07:52 EDT by Stephan Mann CLA
Modified: 2011-06-20 03:58 EDT (History)
2 users (show)

See Also:


Attachments
Fix for the widget use case of StatusMeter (3.24 KB, patch)
2011-05-23 07:53 EDT, Stephan Mann CLA
no flags Details | Diff
this patch is using ImageData (16.75 KB, patch)
2011-05-24 08:52 EDT, Thorsten Schenkel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Mann CLA 2011-05-23 07:52:42 EDT
The current implementation of the StatusMeter fails to free window handles it allocates. Specifically, instances of Image are created and not disposed properly, thus window handles are not released. Since there is a default limit of 10,000 window handles on Win7, this will produce an "SWTError: No more handles" eventually, depending on use and uptime of the application.

The StatusMeter can be used in two different ways. One is the widget StatusMeterWidget/Ridget to use it as a normal SWT control. There is an example in Riena's example client in TraverseSubModuleController. I will attach a patch that fixes the window handle problem for this use case.

The second use case is to use it as an image factory inside a ColumnFormatter. There is an example in TableSubModuleController. Currently, one window handle is "lost" every time a new StatusMeter is rendered in the example (try activating a check box inside the table). Since a ColumnFormatter returns the Image into the user code (see getImage()), the StatusMeter can not know when to dispose the image it created. At the moment I have neither a fix nor a workaround for this problem. Any ideas?
Comment 1 Stephan Mann CLA 2011-05-23 07:53:43 EDT
Created attachment 196322 [details]
Fix for the widget use case of StatusMeter
Comment 2 Nobody - feel free to take it CLA 2011-05-23 09:34:03 EDT
I didn´t have a look in the code but what about returning/managing ImageData instances instead of Image instances? ImageData is display independent and doesn´t eat handles.
You could create your images, draw on gc ..., extract imagedata and the destroy the image...
My 2 cents
Comment 3 Christian Campo CLA 2011-05-23 09:58:23 EDT
The only thing we can do in the Indigo timeframe is fix bugs. We cannot do API changes at this point in time.
Comment 4 Thorsten Schenkel CLA 2011-05-24 08:52:18 EDT
Created attachment 196432 [details]
this patch is using ImageData

The idea of Heiko to use ImageData was very helpful.
So the image can be disposed at the same position (class) where the was created (StatusMeterWidget and TableRidgetLabelProvider).
So it is easier to dispose all unused images.
Comment 5 Thorsten Schenkel CLA 2011-06-20 03:58:46 EDT
patch committed