Program: 94635
Project: 94635
Buggy source:
ChatRoomTab(boolean withParticipantsList,CTabFolder parent,String name,KeyListener keyListener){
  withParticipants=withParticipantsList;
  tabItem=new CTabItem(parent,SWT.NULL);
  tabItem.setText(name);
  if (withParticipants) {
    fullChat=new SashForm(parent,SWT.HORIZONTAL);
    fullChat.setLayout(new FillLayout());
    Composite memberComp=new Composite(fullChat,SWT.NONE);
    GridLayout layout=new GridLayout(1,true);
    layout.marginWidth=0;
    layout.marginHeight=0;
    memberComp.setLayout(layout);
    participantsNumberLabel=new Label(memberComp,SWT.BORDER | SWT.READ_ONLY);
    participantsNumberLabel.setLayoutData(new GridData(SWT.FILL,SWT.BEGINNING,true,false));
    participantsNumberLabel.setAlignment(SWT.CENTER);
    participantsTable=new TableViewer(memberComp,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI);
    participantsTable.setSorter(new ViewerSorter());
    participantsTable.getTable().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
    participantsTable.addOpenListener(new IOpenListener(){
      public void open(      OpenEvent event){
        IStructuredSelection selection=(IStructuredSelection)event.getSelection();
        String user=((ChatRoomParticipant)selection.getFirstElement()).getName();
        if (!ChatRoomManagerView.this.localUserName.equals(user)) {
          try {
            MessagesView messagesView=getMessagesView();
            messagesView.selectTab(container.getPrivateMessageSender(),null,createStringID(localUserName),createStringID(user));
            getSite().getPage().activate(messagesView);
          }
 catch (          PartInitException e) {
            Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,IStatus.ERROR,NLS.bind(Messages.ChatRoomManagerView_EXCEPTION_MESSAGE_VIEW_INITIALIZATION,user),e));
          }
        }
      }
    }
);
    Composite rightComp=new Composite(fullChat,SWT.NONE);
    rightComp.setLayout(layout);
    subjectText=createStyledTextWidget(rightComp,SWT.SINGLE | SWT.BORDER);
    subjectText.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
    subjectText.setEditable(false);
    subjectText.setEnabled(false);
    rightSash=new SashForm(rightComp,SWT.VERTICAL);
    rightSash.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  }
 else   rightSash=new SashForm(parent,SWT.VERTICAL);
  outputText=createStyledTextWidget(rightSash,SWT.BORDER | SWT.WRAP | SWT.V_SCROLL| SWT.MULTI| SWT.READ_ONLY);
  outputText.setEditable(false);
  outputText.setLayoutData(new GridData(GridData.FILL_BOTH));
  inputText=new Text(rightSash,SWT.BORDER | SWT.MULTI | SWT.WRAP| SWT.V_SCROLL);
  if (keyListener != null)   inputText.addKeyListener(keyListener);
  rightSash.setWeights(new int[]{RATIO_READ_PANE,RATIO_WRITE_PANE});
  if (withParticipants) {
    fullChat.setWeights(new int[]{RATIO_PRESENCE_PANE,RATIO_READ_WRITE_PANE});
    tabItem.setControl(fullChat);
  }
 else   tabItem.setControl(rightSash);
  parent.setSelection(tabItem);
  makeActions();
  hookContextMenu();
  if (withParticipants) {
    hookParticipantsContextMenu();
  }
  StyledText st=getOutputText();
  if (st != null) {
    ScrollBar vsb=st.getVerticalBar();
    if (vsb != null) {
      vsb.addSelectionListener(scrollSelectionListener);
      vsb.addDisposeListener(new DisposeListener(){
        public void widgetDisposed(        DisposeEvent e){
          StyledText ot=getOutputText();
          if (ot != null) {
            ScrollBar sb=ot.getVerticalBar();
            if (sb != null)             sb.removeSelectionListener(scrollSelectionListener);
          }
        }
      }
);
    }
  }
}

Fixed version (ground truth):
ChatRoomTab(boolean withParticipantsList,CTabFolder parent,String name,KeyListener keyListener){
  withParticipants=withParticipantsList;
  tabItem=new CTabItem(parent,SWT.NULL);
  tabItem.setText(name);
  if (withParticipants) {
    fullChat=new SashForm(parent,SWT.HORIZONTAL);
    fullChat.setLayout(new FillLayout());
    Composite memberComp=new Composite(fullChat,SWT.NONE);
    GridLayout layout=new GridLayout(1,true);
    layout.marginWidth=0;
    layout.marginHeight=0;
    memberComp.setLayout(layout);
    participantsNumberLabel=new Label(memberComp,SWT.BORDER | SWT.READ_ONLY);
    participantsNumberLabel.setLayoutData(new GridData(SWT.FILL,SWT.BEGINNING,true,false));
    participantsNumberLabel.setAlignment(SWT.CENTER);
    participantsTable=new TableViewer(memberComp,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI);
    participantsTable.setSorter(new ViewerSorter());
    participantsTable.getTable().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
    participantsTable.addOpenListener(new IOpenListener(){
      public void open(      OpenEvent event){
        IStructuredSelection selection=(IStructuredSelection)event.getSelection();
        String user=((ChatRoomParticipant)selection.getFirstElement()).getName();
        if (!ChatRoomManagerView.this.localUserName.equals(user)) {
          try {
            MessagesView messagesView=getMessagesView();
            messagesView.selectTab(container.getPrivateMessageSender(),null,createStringID(localUserName),createStringID(user));
            getSite().getPage().activate(messagesView);
          }
 catch (          PartInitException e) {
            Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,IStatus.ERROR,NLS.bind(Messages.ChatRoomManagerView_EXCEPTION_MESSAGE_VIEW_INITIALIZATION,user),e));
          }
        }
      }
    }
);
    rightComposite=new Composite(fullChat,SWT.NONE);
    layout=new GridLayout(1,true);
    layout.marginHeight=0;
    layout.marginWidth=0;
    rightComposite.setLayout(layout);
    subjectText=createStyledTextWidget(rightComposite,SWT.SINGLE | SWT.BORDER);
    subjectText.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
    subjectText.setEditable(false);
    subjectText.setEnabled(false);
  }
 else {
    rightComposite=new Composite(parent,SWT.NONE);
    GridLayout layout=new GridLayout(1,true);
    layout.marginHeight=0;
    layout.marginWidth=0;
    rightComposite.setLayout(layout);
  }
  outputText=createStyledTextWidget(rightComposite,SWT.BORDER | SWT.WRAP | SWT.V_SCROLL| SWT.MULTI| SWT.READ_ONLY);
  outputText.setEditable(false);
  outputText.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  inputText=new Text(rightComposite,SWT.BORDER | SWT.MULTI | SWT.WRAP| SWT.V_SCROLL);
  GridData gd=new GridData(SWT.FILL,SWT.CENTER,true,false);
  GC gc=new GC(inputText);
  gc.setFont(inputText.getFont());
  FontMetrics fontMetrics=gc.getFontMetrics();
  gc.dispose();
  gd.heightHint=fontMetrics.getHeight() * 2;
  inputText.setLayoutData(gd);
  if (keyListener != null)   inputText.addKeyListener(keyListener);
  if (withParticipants) {
    fullChat.setWeights(new int[]{RATIO_PRESENCE_PANE,RATIO_READ_WRITE_PANE});
    tabItem.setControl(fullChat);
  }
 else   tabItem.setControl(rightComposite);
  parent.setSelection(tabItem);
  makeActions();
  hookContextMenu();
  if (withParticipants) {
    hookParticipantsContextMenu();
  }
  StyledText st=getOutputText();
  if (st != null) {
    ScrollBar vsb=st.getVerticalBar();
    if (vsb != null) {
      vsb.addSelectionListener(scrollSelectionListener);
      vsb.addDisposeListener(new DisposeListener(){
        public void widgetDisposed(        DisposeEvent e){
          StyledText ot=getOutputText();
          if (ot != null) {
            ScrollBar sb=ot.getVerticalBar();
            if (sb != null)             sb.removeSelectionListener(scrollSelectionListener);
          }
        }
      }
);
    }
  }
}