Buggy code:
} data . hPen = OS . CreatePen ( PS_SOLID , 0 , data . foreground ) ; data . hBrush = OS . CreateSolidBrush ( data . background ) ; OS . SelectObject ( hDC , data . hPen ) ; OS . SelectObject ( hDC , data . hBrush ) ; GC gc = GC . win32_new ( hDC , data ) ; Event event = new Event ( ) ; event . item = item ; event . index = index ; event . gc = gc ; event . detail |= SWT . FOREGROUND ; if ( clrTextBk != ( - 1 ) ) event . detail |= SWT . BACKGROUND ; if ( selected && ( ( i == 0 ) || ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) ) ) { event . detail |= SWT . SELECTED ; } if ( ( OS . SendMessage ( handle , TVM_GETNEXTITEM , TVGN_CARET , 0 ) ) == ( nmcd . dwItemSpec ) ) { if ( ( i == 0 ) || ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) ) { if ( ( handle ) == ( OS . GetFocus ( ) ) ) { int uiState = OS . SendMessage ( handle , WM_QUERYUISTATE , 0 , 0 ) ; if ( ( uiState & ( OS . UISF_HIDEFOCUS ) ) == 0 ) event . detail |= SWT . FOCUSED ; } } } event . x = itemRect . left ; event . y = itemRect . top ; event . width = ( itemRect . right ) - ( itemRect . left ) ; event . height = ( itemRect . bottom ) - ( itemRect . top ) ; RECT cellRect = item . getBounds ( index , true , true , true , true , true , hDC ) ; int cellWidth = ( cellRect . right ) - ( cellRect . left ) ; int cellHeight = ( cellRect . bottom ) - ( cellRect . top ) ; gc . setClipping ( cellRect . left , cellRect . top , cellWidth , cellHeight ) ; sendEvent ( PaintItem , event ) ; event . gc = null ; gc . dispose ( ) ; OS . RestoreDC ( hDC , nSavedDC ) ; if ( ( isDisposed ( ) ) || ( item . isDisposed ( ) ) ) break ; } } x += width ; if ( x > ( clientRect . right ) ) break ; } if ( linesVisible ) { if ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) { if ( ( hwndHeader ) != 0 ) { if ( ( OS . SendMessage ( hwndHeader , HDM_GETITEMCOUNT , 0 , 0 ) ) != 0 ) { HDITEM hdItem = new HDITEM ( ) ; hdItem . mask = OS . HDI_WIDTH ; OS . SendMessage ( hwndHeader , HDM_GETITEM , 0 , hdItem ) ; RECT rect = new RECT ( ) ; OS . SetRect ( rect , ( ( nmcd . left ) + ( hdItem . cxy ) ) , nmcd . top , nmcd . right , nmcd . bottom ) ; OS . DrawEdge ( hDC , rect , BDR_SUNKENINNER , BF_BOTTOM ) ; } } } RECT rect = new RECT ( ) ; OS . SetRect ( rect , nmcd . left , nmcd . top , nmcd . right , nmcd . bottom ) ; OS . DrawEdge ( hDC , rect , BDR_SUNKENINNER , BF_BOTTOM ) ; } if ( ( handle ) == ( OS . GetFocus ( ) ) ) { int uiState = OS . SendMessage ( handle , WM_QUERYUISTATE , 0 , 0 ) ; if ( ( uiState & ( OS . UISF_HIDEFOCUS ) ) == 0 ) { int hItem = OS . SendMessage ( handle , TVM_GETNEXTITEM , TVGN_CARET , 0 ) ; if ( hItem == ( item . handle ) ) { <START_BUG> if ( ( ( ! ( ignoreDrawFocus ) ) && ( hooks ( PaintItem ) ) ) || ( ( findImageControl ( ) ) != null ) ) { <END_BUG> if ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) { RECT focusRect = new RECT ( ) ; OS . SetRect ( focusRect , nmcd . left , nmcd . top , nmcd . right , nmcd . bottom ) ; if ( ( count > 0 ) && ( ( hwndHeader ) != 0 ) ) { int width = 0 ; HDITEM hdItem = new HDITEM ( ) ; hdItem . mask = OS . HDI_WIDTH ; for ( int j = 0 ; j < count ; j ++ ) { OS . SendMessage ( hwndHeader , HDM_GETITEM , j , hdItem ) ; width += hdItem . cxy ; } focusRect . left = 0 ; RECT rect = new RECT ( ) ; OS . GetClientRect ( handle , rect ) ; focusRect . right = Math . max ( width , rect . right ) ; } OS . DrawFocusRect ( hDC , focusRect ) ; } else { RECT focusRect = item . getBounds ( 0 , true , false , false , false , false , hDC ) ; RECT clipRect = item . getBounds ( 0 , true , false , false , false , true , hDC ) ; OS . IntersectClipRect ( hDC , clipRect . left , clipRect . top , clipRect . right , clipRect . bottom ) ; OS . DrawFocusRect ( hDC , focusRect ) ; OS . SelectClipRgn ( hDC , 0 ) ; } } } }

Fix:
if ( ( ! ( ignoreDrawFocus ) ) && ( ( hooks ( PaintItem ) ) || ( ( findImageControl ( ) ) != null ) ) ) {