changeset 80:b3daa78bc913

Fix cyclic dependency in TableLayout. Changing static this to lazy initialization.
author Frank Benoit <benoit@tionex.de>
date Sun, 25 May 2008 05:22:47 +0200
parents 0953c252a764
children e28b067ce8c5
files dwtx/jface/viewers/TableLayout.d
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dwtx/jface/viewers/TableLayout.d	Sun May 25 04:55:40 2008 +0200
+++ b/dwtx/jface/viewers/TableLayout.d	Sun May 25 05:22:47 2008 +0200
@@ -49,16 +49,22 @@
      *
      * @since 3.1
      */
-    private static int COLUMN_TRIM;
-
-    static this() {
-        if ("win32".equals(DWT.getPlatform())) { //$NON-NLS-1$
-            COLUMN_TRIM = 4;
-        } else if ("carbon".equals(DWT.getPlatform())) { //$NON-NLS-1$
-            COLUMN_TRIM = 24;
-        } else {
-            COLUMN_TRIM = 3;
+    private static int COLUMN_TRIM_ = -1;
+    private static int COLUMN_TRIM(){
+        if( COLUMN_TRIM_ is -1 ){
+            synchronized( TableLayout.classinfo ){
+                if( COLUMN_TRIM_ is -1 ){
+                    if ("win32".equals(DWT.getPlatform())) { //$NON-NLS-1$
+                        COLUMN_TRIM_ = 4;
+                    } else if ("carbon".equals(DWT.getPlatform())) { //$NON-NLS-1$
+                        COLUMN_TRIM_ = 24;
+                    } else {
+                        COLUMN_TRIM_ = 3;
+                    }
+                }
+            }
         }
+        return COLUMN_TRIM_;
     }
 
     /**