Bug 242466 [JFace] Widget is disposed error when closing dialog from OSX dock
- run the snippet below which shows a dialog - right-click its icon in the OSX dock and select Quit -> the exception at the bottom will be spewed - it looks like the last line of Window.runEventLoop(Shell) should change from: display.update(); to... if (!display.isDisposed()) display.update(); snippet: public static void main (String [] args) { try { final Display display = new Display (); final Shell shell = new Shell (display); TitleAreaDialog dialog = new TitleAreaDialog(shell); dialog.setBlockOnOpen(true); dialog.open(); display.dispose (); } catch (Exception e) { e.printStackTrace(); } } exception: org.eclipse.swt.SWTException: Widget is disposed at org.eclipse.swt.SWT.error(SWT.java:3777) at org.eclipse.swt.SWT.error(SWT.java:3695) at org.eclipse.swt.SWT.error(SWT.java:3666) at org.eclipse.swt.widgets.Display.error(Display.java:1126) at org.eclipse.swt.widgets.Display.checkDevice(Display.java:626) at org.eclipse.swt.widgets.Display.update(Display.java:4084) at org.eclipse.jface.window.Window.runEventLoop(Window.java:832) at org.eclipse.jface.window.Window.open(Window.java:801) at win32.Main1.main(Main1.java:20)
bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java
*            point to find (display coordinates)
	 * @param toFind
	 *            point to find (display coordinates)
	 * @return the montor closest to the given point
	 */
	private static Monitor getClosestMonitor(Display toSearch, Point toFind) {
		int closest = Integer.MAX_VALUE;
		Monitor[] monitors = toSearch.getMonitors();
		Monitor result = monitors[0];
		for (int idx = 0; idx < monitors.length; idx++) {
			Monitor current = monitors[idx];
			Rectangle clientArea = current.getClientArea();
			if (clientArea.contains(toFind)) {
				return current;
			}
			int distance = Geometry.distanceSquared(Geometry
					.centerPoint(clientArea), toFind);
			if (distance < closest) {
				closest = distance;
				result = current;
			}
		}
		return result;
	}
	/**
	 * Given the desired position of the window, this method returns an adjusted
	 * position such that the window is no larger than its monitor, and does not
	 * extend beyond the edge of the monitor. This is used for computing the
	 * initial window position, and subclasses can use this as a utility method
	 * if they want to limit the region in which the window may be moved.