+2007-08-17 Rolf Bjarne Kvinge <RKvinge@novell.com>
+
+ * XplatUIWin32.cs: Don't call Win32GetLastError directly, use
+ Marshal.GetLastWin32Error. Plug nasty memory leak in
+ PaintEventStart/End, we were creating a DC we weren't releasing.
+
2007-08-17 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* ListView.cs: Add Groups support in Details view. Also have a small
HwndCreating = null;
if (WindowHandle==IntPtr.Zero) {
- uint error = Win32GetLastError();
+ int error = Marshal.GetLastWin32Error ();
Win32MessageBox(IntPtr.Zero, "Error : " + error.ToString(), "Failed to create window, class '"+cp.ClassName+"'", 0);
}
clip_rect = new Rectangle(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right-ps.rcPaint.left, ps.rcPaint.bottom-ps.rcPaint.top);
} else {
hdc = Win32GetDC(handle);
- // FIXME: Add the DC to internal list
- hwnd.drawing_stack.Push (null);
+ hwnd.drawing_stack.Push (hdc);
clip_rect = new Rectangle(rect.top, rect.left, rect.right-rect.left, rect.bottom-rect.top);
}
if (client) {
object o = hwnd.drawing_stack.Pop();
if (o != null) {
- PAINTSTRUCT ps = (PAINTSTRUCT)o;
- Win32EndPaint(handle, ref ps);
+ if (o is PAINTSTRUCT) {
+ PAINTSTRUCT ps = (PAINTSTRUCT)o;
+ Win32EndPaint(handle, ref ps);
+ } else if (o is IntPtr) {
+ IntPtr hdc = (IntPtr) o;
+ Win32ReleaseDC (handle, hdc);
+ }
}
} else {
IntPtr hdc = (IntPtr)hwnd.drawing_stack.Pop();