1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Add DeleteObject calls to go with the CreatePen calls in do_text. Should

fix a fairly nasty-looking resource leak. Thanks to Andrew Mobbs.

[originally from svn r34]
This commit is contained in:
Simon Tatham 1999-02-10 11:11:11 +00:00
parent 37f49f0adf
commit ac015f51e0

View File

@ -866,7 +866,10 @@ static int WINAPI WndProc (HWND hwnd, UINT message,
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)
SetWindowText (hwnd, window_name);
if (!ignore_size) {
int width, height, w, h, ew, eh;
int width, height, w, h;
#if 0 /* we have fixed this using WM_SIZING now */
int ew, eh;
#endif
width = LOWORD(lParam);
height = HIWORD(lParam);
@ -1084,18 +1087,24 @@ void do_text (Context ctx, int x, int y, char *text, int len,
TextOut (hdc, x-1, y, text, len);
}
if (und_mode == UND_LINE && (attr & ATTR_UNDER)) {
SelectObject (hdc, CreatePen(PS_SOLID, 0, fg));
HPEN oldpen;
oldpen = SelectObject (hdc, CreatePen(PS_SOLID, 0, fg));
MoveToEx (hdc, x, y+descent, NULL);
LineTo (hdc, x+len*font_width, y+descent);
oldpen = SelectObject (hdc, oldpen);
DeleteObject (oldpen);
}
if (attr & ATTR_PASCURS) {
POINT pts[5];
HPEN oldpen;
pts[0].x = pts[1].x = pts[4].x = x;
pts[2].x = pts[3].x = x+font_width-1;
pts[0].y = pts[3].y = pts[4].y = y;
pts[1].y = pts[2].y = y+font_height-1;
SelectObject (hdc, CreatePen(PS_SOLID, 0, colours[23]));
oldpen = SelectObject (hdc, CreatePen(PS_SOLID, 0, colours[23]));
Polyline (hdc, pts, 5);
oldpen = SelectObject (hdc, oldpen);
DeleteObject (oldpen);
}
}