Le 20/04/15 19:23, Stefan Seelmann a écrit :
> On 04/20/2015 06:42 PM, Emmanuel Lécharny wrote:
>> Hi Stefan,
>>
>> just to be sure, there are many places we create Color() objects, but we
>> never dispose them. The API documentation says :
>>
>> "You must dispose the color when it is no longer required."
> In fact that is true for all classes in org.eclipse.swt.graphics.*
>
>> I was thiunking about moving the color declaration to the
>> CommonUIConstants class, and free them in the CommonUIPlugin class, tjis
>> way :
>>
>> in CommonUIConstants :
>> public static final Color BLACK_COLOR = new Color( null, BLACK );
>>
>> and in CommonUIPlugin :
>>
>> public void stop( BundleContext context ) throws Exception
>> {
>> plugin = null;
>>
>> // Dispose the colors
>> CommonUIConstants.BLACK_COLOR.dispose();
>> CommonUIConstants.WHITE_COLOR.dispose();
>> ...
>>
>> Do you think this is correct ?
> Hm, it doesn't look correct. The creation is done in static initalizer
> but the dispose in bundle stop method. What if the bundle is started
> again, then the static initialization isn't done. (or does OSGi does it?)
Rigth, right ! And we have a 'start' method just for that. Will work
around the idea.
>
>> For specific colors, I think creating them in the Plugin where they are
>> used, and disposing them there too is the right way.
>>
>> wdyt ?
>>
> Yes, that sounds good.
>
> I'm sure we lack lot of resources. I think we need to tackle them but
> first I'd like to get a release out...
Sure ! I was just asking because I was faced with the issue, and wanted
to know what to do about it.
Bottom line : I'll create a JIRA.
Thanks Stefan !