Buggy code:
} data . uiState = ( ( int ) ( OS . SendMessage ( handle , WM_QUERYUISTATE , 0 , 0 ) ) ) ; 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 ( hot ) event . detail |= SWT . HOT ; if ( selected && ( ( i == 0 ) || ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) ) ) { event . detail |= SWT . SELECTED ; } if ( ! ( explorerTheme ) ) { 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 = ( ( int ) ( 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 ( ! ( explorerTheme ) ) { if ( ( handle ) == ( OS . GetFocus ( ) ) ) { int uiState = ( ( int ) ( 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 ) ) { <END_BUG> if ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) { RECT focusRect = new RECT ( ) ; OS . SetRect ( focusRect , 0 , nmcd . top , ( ( clientRect . right ) + 1 ) , nmcd . bottom ) ; OS . DrawFocusRect ( hDC , focusRect ) ; } else { int index = ( ( int ) ( OS . SendMessage ( hwndHeader , HDM_ORDERTOINDEX , 0 , 0 ) ) ) ; RECT focusRect = item . getBounds ( index , true , false , false , false , false , hDC ) ; RECT clipRect = item . getBounds ( index , 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 ) ; } } } } } } return new LRESULT ( OS . CDRF_DODEFAULT ) ; } LRESULT CDDS_ITEMPREPAINT ( NMTVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_POSTPAINT ( NMTVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_PREPAINT ( NMTVCUSTOMDRAW nmcd , int wParam , int lParam ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam ) { } void checkBuffered ( ) { } boolean checkData ( TreeItem item , boolean redraw ) { } boolean checkData ( TreeItem item , int index , boolean redraw ) { }

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