# HG changeset patch # User Frank Benoit # Date 1234973451 -3600 # Node ID 47b37f12674089f7de5298216a55e4682c85e449 # Parent c49e17d48b76cd7c01f04675f6bb371e1602a6e1 Global flag to disable the dispose checking diff -r c49e17d48b76 -r 47b37f126740 dwt/graphics/Resource.d --- 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() ); } }