Mercurial > projects > dwt-win
changeset 335:47b37f126740
Global flag to disable the dispose checking
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 18 Feb 2009 17:10:51 +0100 |
parents | c49e17d48b76 |
children | f866e80af235 |
files | dwt/graphics/Resource.d |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/graphics/Resource.d Wed Feb 18 16:14:31 2009 +0100 +++ b/dwt/graphics/Resource.d Wed Feb 18 17:10:51 2009 +0100 @@ -14,7 +14,6 @@ import dwt.DWT; import dwt.graphics.Device; -//import tango.util.log.Trace; /** * This class is the abstract superclass of all graphics resource objects. @@ -42,7 +41,9 @@ public abstract class Resource { /// DWT extension for D: do no dispose check - bool disposeChecking = true; + public bool disposeChecking = true; + /// DWT extension for D: do no dispose check + public static bool globalDisposeChecking = true; /** * the device where this resource was created @@ -59,9 +60,13 @@ } ~this(){ - if( disposeChecking && !isDisposed() ){ - //Trace.formatln("{} {} {} Resource deleted, but is not yet disposed", __FILE__, __LINE__, this.classinfo.name ); - DWT.error( 0, null, " Resource deleted, but is not yet disposed: (" ~ this.classinfo.name ~ ") " ~ this.toString() ); + if( globalDisposeChecking && disposeChecking && !isDisposed() ){ + DWT.error( 0, null, " Resource deleted, but is not yet disposed. " + "This check can be disabled with " + "\"import dwt.graphics.Resource; " + "Resource.globalDisposeChecking = false; \". " + "This problem occured with type " ~ this.classinfo.name ~ + " this.toString()=" ~ this.toString() ); } }