Mercurial > projects > dwt-win
diff dwt/widgets/Widget.d @ 80:1801ddeb8f32
removed static ctors
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 06 Feb 2008 12:09:44 +0100 |
parents | 205350493476 |
children | 43c42c637c9c |
line wrap: on
line diff
--- a/dwt/widgets/Widget.d Wed Feb 06 11:08:01 2008 +0100 +++ b/dwt/widgets/Widget.d Wed Feb 06 12:09:44 2008 +0100 @@ -108,20 +108,32 @@ /* Check and initialize the Common Controls DLL */ static const int MAJOR = 5, MINOR = 80; - static this() { - static if (!OS.IsWinCE) { - if (OS.COMCTL32_VERSION < OS.VERSION (MAJOR, MINOR)) { - Stdout.formatln ("***WARNING: DWT requires comctl32.dll version {}.{} or greater", MAJOR, MINOR); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - Stdout.formatln ("***WARNING: Detected: {}.{}", OS.COMCTL32_MAJOR, OS.COMCTL32_MINOR); //$NON-NLS-1$ //$NON-NLS-2$ + + private static bool static_this_completed = false; + private static void static_this() { + if( static_this_completed ){ + return; + } + synchronized { + if( static_this_completed ){ + return; } + static if (!OS.IsWinCE) { + if (OS.COMCTL32_VERSION < OS.VERSION (MAJOR, MINOR)) { + Stdout.formatln ("***WARNING: DWT requires comctl32.dll version {}.{} or greater", MAJOR, MINOR); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Stdout.formatln ("***WARNING: Detected: {}.{}", OS.COMCTL32_MAJOR, OS.COMCTL32_MINOR); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + OS.InitCommonControls (); + static_this_completed = true; } - OS.InitCommonControls (); } /** * Prevents uninitialized instances from being created outside the package. */ this () { + static_this(); } /** @@ -154,6 +166,7 @@ * @see #getStyle */ public this (Widget parent, int style) { + static_this(); checkSubclass (); checkParent (parent); this.style = style;