summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2020-04-17 13:57:19 +0200
committerErik Faye-Lund <erik.faye-lund@collabora.com>2020-04-20 11:48:44 +0200
commit27813895adef5866e9aee62975c7f5965cd9c601 (patch)
tree9dffca748bd1cdb7ad7bcb59225d0dc56e51c7ad
parentb571364ae09c2af5f0480f10c4220a82b53d2443 (diff)
wglgears: do not re-create window after re-creating context
When we re-created the window, we accidentally leaked the old window. It's not so easy to notice, because it's invisible, but it's still there and taking up some memory. But there's more problems; when I recently added the -geometry switch, I missed the extra CreateWindowEx call, meaning this call didn't respect the x and y offset. But instead of fixing these things indevidually, let's take a step back here. There's no reason to re-create the window here in the first place. We can just set a new pixel-format on hDC and re-create hRC instead. This makes the code both easier to maintain, and squashes a couple of bugs. Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--src/wgl/wglgears.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/wgl/wglgears.c b/src/wgl/wglgears.c
index c78ef4aa..7f0d7742 100644
--- a/src/wgl/wglgears.c
+++ b/src/wgl/wglgears.c
@@ -473,16 +473,6 @@ make_window(const char *name, int x, int y, int width, int height)
/* now, create new context with new pixel format */
wglMakeCurrent(hDC, NULL);
wglDeleteContext(hRC);
- DeleteDC(hDC);
-
- hWnd = CreateWindowEx(dwExStyle, name, name,
- WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dwStyle,
- 0, 0,
- winrect.right - winrect.left,
- winrect.bottom - winrect.top,
- NULL, NULL, hInst, NULL);
-
- hDC = GetDC(hWnd);
SetPixelFormat(hDC, pixelFormat, &pfd);
hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC, hRC);