From 4aab9cc79e7b0496ec447bad67225dc1c3486bef Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 8 Mar 2019 08:43:49 -0800 Subject: Fix a 64-bit issue in our Windows UI code (#887) Fixes issue #874 The problem here was that a pointer was being cast to `LONG` so that it could be used with the `SetWindowLongPtr` API, but that API actually expects a `LONG_PTR`. Since `LONG` is a 32-bit type on 64-bit Windows, the pointer we stored was getting truncated, leading to crashes. I'm kind of surprised this wasn't biting more of our applications (e.g., the render tests). --- tools/gfx/window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/gfx/window.cpp') diff --git a/tools/gfx/window.cpp b/tools/gfx/window.cpp index 9e2195141..02a083ef2 100644 --- a/tools/gfx/window.cpp +++ b/tools/gfx/window.cpp @@ -173,7 +173,7 @@ static LRESULT CALLBACK windowProc( window = (Window*) createInfo->lpCreateParams; window->handle = windowHandle; - SetWindowLongPtrW(windowHandle, GWLP_USERDATA, (LONG)size_t(window)); + SetWindowLongPtrW(windowHandle, GWLP_USERDATA, (LONG_PTR) window); } break; -- cgit v1.2.3