directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <elecha...@gmail.com>
Subject [Studio] Color disposal
Date Mon, 20 Apr 2015 16:42:31 GMT
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."

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 ?

For specific colors, I think creating them in the Plugin where they are
used, and disposing them there too is the right way.

wdyt ?


Mime
View raw message