diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java index df1b6c56228..4c45c782719 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/SelectionListenerWithASTManager.java @@ -175,7 +175,16 @@ public class SelectionListenerWithASTManager { listeners= fAstListeners.getListeners(); } for (int i= 0; i < listeners.length; i++) { - ((ISelectionListenerWithAST) listeners[i]).selectionChanged(fPart, selection, astRoot); + final Object l = listeners[i]; + try { + ((ISelectionListenerWithAST) l).selectionChanged(fPart, selection, astRoot); + } catch (RuntimeException e) { + CUIPlugin.log(e); + fAstListeners.remove(l); + } catch (OutOfMemoryError e) { + CUIPlugin.log(e); + fAstListeners.remove(l); + } } return Status.OK_STATUS; }