Buggy code:
OS . MoveMemory ( phdn , lParam , sizeof ) ; if ( ( phdn . iItem ) != ( - 1 ) ) { TreeColumn column = columns [ phdn . iItem ] ; if ( ( column != null ) && ( ! ( column . getMoveable ( ) ) ) ) { ignoreColumnMove = true ; return LRESULT . ONE ; } } break ; } case OS . HDN_ENDDRAG : { NMHEADER phdn = new NMHEADER ( ) ; OS . MoveMemory ( phdn , lParam , sizeof ) ; if ( ( ( phdn . iItem ) != ( - 1 ) ) && ( ( phdn . pitem ) != 0 ) ) { HDITEM pitem = new HDITEM ( ) ; OS . MoveMemory ( pitem , phdn . pitem , HDITEM . sizeof ) ; if ( ( ( ( pitem . mask ) & ( OS . HDI_ORDER ) ) != 0 ) && ( ( pitem . iOrder ) != ( - 1 ) ) ) { int count = OS . SendMessage ( hwndHeader , HDM_GETITEMCOUNT , 0 , 0 ) ; int [ ] order = new int [ count ] ; OS . SendMessage ( hwndHeader , HDM_GETORDERARRAY , count , order ) ; int index = 0 ; while ( index < ( order . length ) ) { if ( ( order [ index ] ) == ( phdn . iItem ) ) break ; index ++ ; } if ( index == ( order . length ) ) index = 0 ; if ( index == ( pitem . iOrder ) ) break ; int start = Math . min ( index , pitem . iOrder ) ; int end = Math . max ( index , pitem . iOrder ) ; RECT rect = new RECT ( ) ; RECT headerRect = new RECT ( ) ; OS . GetClientRect ( handle , rect ) ; OS . SendMessage ( hwndHeader , HDM_GETITEMRECT , order [ start ] , headerRect ) ; rect . left = Math . max ( rect . left , headerRect . left ) ; OS . SendMessage ( hwndHeader , HDM_GETITEMRECT , order [ end ] , headerRect ) ; rect . right = Math . min ( rect . right , headerRect . right ) ; OS . InvalidateRect ( handle , rect , true ) ; ignoreColumnMove = false ; for ( int i = start ; i <= end ; i ++ ) { TreeColumn column = columns [ order [ i ] ] ; if ( ! ( column . isDisposed ( ) ) ) { column . postEvent ( Move ) ; } } } } break ; } case OS . HDN_ITEMCHANGINGW : case OS . HDN_ITEMCHANGINGA : { NMHEADER phdn = new NMHEADER ( ) ; OS . MoveMemory ( phdn , lParam , sizeof ) ; if ( ( phdn . pitem ) != 0 ) { HDITEM newItem = new HDITEM ( ) ; OS . MoveMemory ( newItem , phdn . pitem , HDITEM . sizeof ) ; if ( ( ( newItem . mask ) & ( OS . HDI_WIDTH ) ) != 0 ) { RECT rect = new RECT ( ) ; OS . GetClientRect ( handle , rect ) ; RECT headerRect = new RECT ( ) ; int count = OS . SendMessage ( hwndHeader , HDM_GETITEMCOUNT , 0 , 0 ) ; int index = OS . SendMessage ( hwndHeader , HDM_ORDERTOINDEX , ( count - 1 ) , 0 ) ; OS . SendMessage ( hwndHeader , HDM_GETITEMRECT , index , headerRect ) ; rect . right = Math . max ( rect . right , headerRect . right ) ; OS . SendMessage ( hwndHeader , HDM_GETITEMRECT , phdn . iItem , headerRect ) ; <START_BUG> int gridWidth = ( getLinesVisible ( ) ) ? Tree . GRID_WIDTH : 0 ; <END_BUG> rect . left = ( headerRect . right ) - gridWidth ; if ( ( ( ( findImageControl ( ) ) != null ) || ( hooks ( EraseItem ) ) ) || ( hooks ( PaintItem ) ) ) { OS . InvalidateRect ( handle , rect , true ) ; } else { HDITEM oldItem = new HDITEM ( ) ; oldItem . mask = OS . HDI_WIDTH ; OS . SendMessage ( hwndHeader , HDM_GETITEM , phdn . iItem , oldItem ) ; int deltaX = ( newItem . cxy ) - ( oldItem . cxy ) ; int flags = ( OS . SW_INVALIDATE ) | ( OS . SW_ERASE ) ; OS . ScrollWindowEx ( handle , deltaX , 0 , rect , null , 0 , null , flags ) ; } if ( ( OS . SendMessage ( hwndHeader , HDM_ORDERTOINDEX , phdn . iItem , 0 ) ) != 0 ) { rect . left = headerRect . left ; rect . right = headerRect . right ; OS . InvalidateRect ( handle , rect , true ) ; } setScrollWidth ( ) ; } } break ; } case OS . HDN_ITEMCHANGEDW : case OS . HDN_ITEMCHANGEDA : { NMHEADER phdn = new NMHEADER ( ) ; OS . MoveMemory ( phdn , lParam , sizeof ) ; if ( ( phdn . pitem ) != 0 ) { HDITEM pitem = new HDITEM ( ) ; OS . MoveMemory ( pitem , phdn . pitem , HDITEM . sizeof ) ; if ( ( ( pitem . mask ) & ( OS . HDI_WIDTH ) ) != 0 ) { if ( ( ( style ) & ( SWT . DOUBLE_BUFFERED ) ) == 0 ) { if ( ignoreColumnMove ) { int oldStyle = style ; style |= SWT . DOUBLE_BUFFERED ; OS . UpdateWindow ( handle ) ; style = oldStyle ;

Fix:
int gridWidth = ( linesVisible ) ? Tree . GRID_WIDTH : 0 ;