Program: 57881
Project: 57881
Buggy source:
private static void popupMenu(final ContextMenuCreator menuCreator,final int retriesLeft,final Shell activeShell){
  final Display display=menuCreator.getParent().getDisplay();
  final int[] count=new int[1];
  Runnable r=new Runnable(){
    public void run(){
      popupShell.setActive();
      final Menu menu=menuCreator.create(popupShell);
      menu.addListener(SWT.Hide,new Listener(){
        public void handleEvent(        Event e){
          activeShell.setActive();
        }
      }
);
      menu.addListener(SWT.Show,new Listener(){
        public void handleEvent(        Event e){
          count[0]++;
          if (!menu.isVisible() && count[0] > MAX_ATTEMPTS) {
            Runnable r=new Runnable(){
              public void run(){
                System.err.println("String_Node_Str" + MAX_ATTEMPTS + "String_Node_Str");
                menu.setVisible(false);
                menu.dispose();
                System.err.println("String_Node_Str");
                showMenu(menuCreator,retriesLeft - 1);
              }
            }
;
            display.asyncExec(r);
            return;
          }
          Runnable runnable=new Runnable(){
            public void run(){
              if (!menu.isDisposed() && !menu.isVisible())               menu.setVisible(true);
 else {
              }
            }
          }
;
          display.asyncExec(runnable);
        }
      }
);
      popupShell.addListener(SWT.Deactivate,new Listener(){
        @Override public void handleEvent(        Event event){
          if (!popupShell.isDisposed()) {
            popupShell.close();
            popupShell.dispose();
          }
          menuCreator.getView().setLazyMode(false);
        }
      }
);
      menu.setVisible(true);
    }
  }
;
  display.asyncExec(r);
}

Fixed version (ground truth):
private static void popupMenu(final ContextMenuCreator menuCreator,final int retriesLeft,final Shell activeShell){
  final Display display=menuCreator.getParent().getDisplay();
  final int[] count=new int[1];
  Runnable r=new Runnable(){
    public void run(){
      popupShell.setActive();
      final Menu menu=menuCreator.create(popupShell);
      menu.addListener(SWT.Hide,new Listener(){
        public void handleEvent(        Event e){
          activeShell.setActive();
        }
      }
);
      menu.addListener(SWT.Show,new Listener(){
        public void handleEvent(        Event e){
          count[0]++;
          if (!menu.isVisible() && count[0] > MAX_ATTEMPTS) {
            Runnable r=new Runnable(){
              public void run(){
                System.err.println("String_Node_Str" + MAX_ATTEMPTS + "String_Node_Str");
                menu.setVisible(false);
                menu.dispose();
                System.err.println("String_Node_Str");
                showMenu(menuCreator,retriesLeft - 1);
              }
            }
;
            display.asyncExec(r);
            return;
          }
          Runnable runnable=new Runnable(){
            public void run(){
              if (!menu.isDisposed() && !menu.isVisible())               menu.setVisible(true);
 else {
              }
            }
          }
;
          display.asyncExec(runnable);
        }
      }
);
      if (!System.getProperty("String_Node_Str").contains("String_Node_Str") && !System.getProperty("String_Node_Str").contains("String_Node_Str")) {
        popupShell.addListener(SWT.Deactivate,new Listener(){
          @Override public void handleEvent(          Event event){
            if (!popupShell.isDisposed()) {
              popupShell.close();
              popupShell.dispose();
            }
            menuCreator.getView().setLazyMode(false);
          }
        }
);
      }
      menu.setVisible(true);
    }
  }
;
  display.asyncExec(r);
}