*** empty log message ***
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
index cae7e50..90efba7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
@@ -286,12 +286,16 @@
* happen when a GC is disposed and the user has
* not caused new pens or brushes to be allocated.
*/
- int nullPen = OS.GetStockObject(OS.NULL_PEN);
- int oldPen = OS.SelectObject(handle, nullPen);
- OS.DeleteObject(oldPen);
- int nullBrush = OS.GetStockObject(OS.NULL_BRUSH);
- int oldBrush = OS.SelectObject(handle, nullBrush);
- OS.DeleteObject(oldBrush);
+ if (data.foreground != -1) {
+ int nullPen = OS.GetStockObject(OS.NULL_PEN);
+ int oldPen = OS.SelectObject(handle, nullPen);
+ OS.DeleteObject(oldPen);
+ }
+ if (data.background != -1) {
+ int nullBrush = OS.GetStockObject(OS.NULL_BRUSH);
+ int oldBrush = OS.SelectObject(handle, nullBrush);
+ OS.DeleteObject(oldBrush);
+ }
/*
* Put back the original bitmap into the device context.
@@ -2144,6 +2148,7 @@
if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
if (OS.GetBkColor(handle) == color.handle) return;
+ data.background = color.handle;
OS.SetBkColor (handle, color.handle);
int newBrush = OS.CreateSolidBrush (color.handle);
int oldBrush = OS.SelectObject (handle, newBrush);
@@ -2254,6 +2259,7 @@
if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
if (OS.GetTextColor(handle) == color.handle) return;
+ data.foreground = color.handle;
int hPen = OS.GetCurrentObject(handle, OS.OBJ_PEN);
LOGPEN logPen = new LOGPEN();
OS.GetObject(hPen, LOGPEN.sizeof, logPen);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
index f9cbff6..834f5a1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
@@ -964,7 +964,7 @@
data.device = display;
GC gc = GC.win32_new (struct.hDC, data);
gc.drawImage (image, struct.left, struct.top + 2);
-// gc.dispose ();
+ gc.dispose ();
}
return null;
}