Bug 205282 [Forms] BusyIndicator causes and swallows several exceptions
Build ID: I20070921-0919 The new implementation of the BusyIndicator introduced in 3.4 M2 causes several exceptions, which, however, are swallowed in an empty catch block. You will catch these exceptions when Exception breakpoints for NPE and others are enabled. The problem obviously occurs when setBusy is called frequently. I have a search text field in my form in which every ModifyEvent triggers a new search, i.e. every character typed in will cause an update an therefore setBusy will be called in quick succession. If you have problems to reproduce the bug, I could try to cut my Forms code down to a small bug snippet. The exceptions thrown are as follows: org.eclipse.swt.SWTError: No more handles at org.eclipse.swt.SWT.error(SWT.java:3717) at org.eclipse.swt.SWT.error(SWT.java:3609) at org.eclipse.swt.SWT.error(SWT.java:3580) at org.eclipse.swt.graphics.Image.createGdipImage(Image.java:870) at org.eclipse.swt.graphics.GC.drawImage(GC.java:897) at org.eclipse.swt.graphics.GC.drawImage(GC.java:891) at org.eclipse.ui.internal.forms.widgets.BusyIndicator$2.run(BusyIndicator.java:123) java.lang.NullPointerException at org.eclipse.swt.graphics.Image.dispose(Image.java:1038) at org.eclipse.ui.internal.forms.widgets.BusyIndicator.clearImages(BusyIndicator.java:303) at org.eclipse.ui.internal.forms.widgets.BusyIndicator.access$0(BusyIndicator.java:299) at org.eclipse.ui.internal.forms.widgets.BusyIndicator$2.run(BusyIndicator.java:188) java.lang.NullPointerException at org.eclipse.swt.graphics.Image.createGdipImage(Image.java:865) at org.eclipse.swt.graphics.GC.drawImage(GC.java:897) at org.eclipse.swt.graphics.GC.drawImage(GC.java:891) at org.eclipse.ui.internal.forms.widgets.BusyIndicator$2.run(BusyIndicator.java:123) Exception in thread "Thread-72" java.lang.OutOfMemoryError: Java heap space at org.eclipse.swt.graphics.Image.getImageData(Image.java:1440) at org.eclipse.ui.internal.forms.widgets.BusyIndicator$2.run(BusyIndicator.java:122) Line 176 in org.eclipse.ui.internal.forms.widgets.BusyIndicator protected synchronized void createBusyThread() { ... busyThread = new Thread() { private Image timage; public void run() { try { ... } catch (Exception e) { <<< empty catch block swallows these exceptions } finally { ... } } ... }
bundles/org.eclipse.ui.forms/src/org/eclipse/ui/internal/forms/widgets/BusyIndicator.java
* Create the first image and draw it on the off-screen
					 * image.
					 */
					int imageDataIndex = 0;
					timage = getImage(imageDataIndex);
					ImageData imageData = timage.getImageData();
					offScreenImageGC.drawImage(timage, 0, 0,
							imageData.width, imageData.height, imageData.x,
							imageData.y, imageData.width, imageData.height);
					/*
					 * Now loop through the images, creating and drawing
					 * each one on the off-screen image before drawing it on
					 * the shell.
					 */
					while (!stop && !isDisposed() && timage != null) {
		
						/*
						 * Fill with the background color before
						 * drawing.
						 */
						final ImageData fimageData = imageData;
						display.syncExec(new Runnable() {
							public void run() {
								if (!isDisposed()) {
									drawBackground(offScreenImageGC, fimageData.x,
											fimageData.y, fimageData.width,
											fimageData.height);
								}
							}
						});