Buggy code:
public void removeTreeListener ( TreeListener listener ) { } public void setInsertMark ( TreeItem item , boolean before ) { } public void setLinesVisible ( boolean show ) { } int scrolledHandle ( ) { } public void selectAll ( ) { } void setBackgroundPixel ( int pixel ) { } void setBounds ( int x , int y , int width , int height , int flags ) { } void setCursor ( ) { } void setCheckboxImageList ( ) { } void setForegroundPixel ( int pixel ) { } public void setHeaderVisible ( boolean show ) { } public void setRedraw ( boolean redraw ) { } void setScrollWidth ( ) { } public void setSelection ( TreeItem [ ] items ) { } public void setTopItem ( TreeItem item ) { } void showItem ( int hItem ) { } public void showColumn ( TreeColumn column ) { } public void showItem ( TreeItem item ) { } public void showSelection ( ) { } void showWidget ( boolean visible ) { } String toolTipText ( NMTTDISPINFO hdr ) { } int topHandle ( ) { } void updateScrollBar ( ) { } int widgetStyle ( ) { } TCHAR windowClass ( ) { } int windowProc ( ) { } int windowProc ( int hwnd , int msg , int wParam , int lParam ) { } LRESULT WM_CHAR ( int wParam , int lParam ) { } LRESULT WM_GETOBJECT ( int wParam , int lParam ) { } LRESULT WM_KEYDOWN ( int wParam , int lParam ) { } LRESULT WM_KILLFOCUS ( int wParam , int lParam ) { } LRESULT WM_LBUTTONDBLCLK ( int wParam , int lParam ) { } LRESULT WM_LBUTTONDOWN ( int wParam , int lParam ) { } LRESULT WM_MOVE ( int wParam , int lParam ) { } LRESULT WM_NOTIFY ( int wParam , int lParam ) { } LRESULT WM_RBUTTONDOWN ( int wParam , int lParam ) { } LRESULT WM_PRINTCLIENT ( int wParam , int lParam ) { } LRESULT WM_SETFOCUS ( int wParam , int lParam ) { } LRESULT WM_SETFONT ( int wParam , int lParam ) { } LRESULT WM_SIZE ( int wParam , int lParam ) { } LRESULT WM_SYSCOLORCHANGE ( int wParam , int lParam ) { } LRESULT wmColorChild ( int wParam , int lParam ) { } LRESULT wmNotifyChild ( int wParam , int lParam ) { NMHDR hdr = new NMHDR ( ) ; OS . MoveMemory ( hdr , lParam , sizeof ) ; switch ( hdr . code ) { case OS . TVN_GETDISPINFOA : case OS . TVN_GETDISPINFOW : { NMTVDISPINFO lptvdi = new NMTVDISPINFO ( ) ; OS . MoveMemory ( lptvdi , lParam , NMTVDISPINFO . sizeof ) ; if ( ( items ) == null ) break ; TreeItem item = items [ lptvdi . lParam ] ; if ( item == null ) break ; if ( ( ( lptvdi . mask ) & ( OS . TVIF_TEXT ) ) != 0 ) { String string = item . text ; TCHAR buffer = new TCHAR ( getCodePage ( ) , string , false ) ; int byteCount = ( Math . min ( buffer . length ( ) , ( ( lptvdi . cchTextMax ) - 1 ) ) ) * ( TCHAR . sizeof ) ; OS . MoveMemory ( lptvdi . pszText , buffer , byteCount ) ; OS . MoveMemory ( ( ( lptvdi . pszText ) + byteCount ) , new byte [ TCHAR . sizeof ] , TCHAR . sizeof ) ; lptvdi . cchTextMax = Math . min ( lptvdi . cchTextMax , ( ( string . length ( ) ) + 1 ) ) ; } if ( ( ( lptvdi . mask ) & ( ( OS . TVIF_IMAGE ) | ( OS . TVIF_SELECTEDIMAGE ) ) ) != 0 ) { Image image = item . image ; <START_BUG> lptvdi . iImage = OS . I_IMAGENONE ; <END_BUG> if ( image != null ) { lptvdi . iImage = lptvdi . iSelectedImage = imageIndex ( image ) ; } } OS . MoveMemory ( lParam , lptvdi , NMTVDISPINFO . sizeof ) ; break ; } case OS . NM_CUSTOMDRAW : { if ( ! ( customDraw ) ) break ; NMTVCUSTOMDRAW nmcd = new NMTVCUSTOMDRAW ( ) ; OS . MoveMemory ( nmcd , lParam , NMTVCUSTOMDRAW . sizeof ) ; switch ( nmcd . dwDrawStage ) { case OS . CDDS_PREPAINT : { return new LRESULT ( ( ( OS . CDRF_NOTIFYITEMDRAW ) | ( OS . CDRF_NOTIFYPOSTPAINT ) ) ) ; } case OS . CDDS_POSTPAINT : { if ( linesVisible ) { int hDC = nmcd . hdc ; if ( ( hwndHeader ) != 0 ) { int x = 0 ; RECT rect = new RECT ( ) ; HDITEM hdItem = new HDITEM ( ) ; hdItem . mask = OS . HDI_WIDTH ; int count = OS . SendMessage ( hwndHeader , HDM_GETITEMCOUNT , 0 , 0 ) ; for ( int i = 0 ; i < count ; i ++ ) { OS . SendMessage ( hwndHeader , HDM_GETITEM , i , hdItem ) ; OS . SetRect ( rect , x , nmcd . top , ( x + ( hdItem . cxy ) ) , nmcd . bottom ) ; OS . DrawEdge ( hDC , rect , BDR_SUNKENINNER , BF_RIGHT ) ; x += hdItem . cxy ; } } RECT rect = new RECT ( ) ; int hItem = OS . SendMessage ( handle , TVM_GETNEXTITEM , TVGN_LASTVISIBLE , 0 ) ; rect . left = hItem ; if ( ( OS . SendMessage ( handle , TVM_GETITEMRECT , 0 , rect ) ) != 0 ) { int height = ( rect . bottom ) - ( rect . top ) ;

Fix:
lptvdi . iImage = lptvdi . iSelectedImage = OS . I_IMAGENONE ;