Community
Participate
Working Groups
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?
Created attachment 196322 [details] Fix for the widget use case of StatusMeter
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
The only thing we can do in the Indigo timeframe is fix bugs. We cannot do API changes at this point in time.
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.
patch committed