Mercurial > projects > dwt-win
changeset 333:684eed7589a0
Generate error if a resource is deleted without disposal. Without that, is is very hard to find accidental deleted/scoped Color/Font/..
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 10 Feb 2009 17:14:24 +0100 |
parents | 1ee938a6e02e |
children | c49e17d48b76 |
files | dwt/graphics/Resource.d |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/graphics/Resource.d Sun Feb 01 19:40:09 2009 +0100 +++ b/dwt/graphics/Resource.d Tue Feb 10 17:14:24 2009 +0100 @@ -14,6 +14,7 @@ import dwt.DWT; import dwt.graphics.Device; +//import tango.util.log.Trace; /** * This class is the abstract superclass of all graphics resource objects. @@ -54,6 +55,13 @@ this.device = device; } +~this(){ + if( !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 ~ ")" ); + } +} + void destroy() { }