Skip to content

Commit

Permalink
windows: Call GetWindowText() with the correct parameters (thanks, Ze…
Browse files Browse the repository at this point in the history
…bediah!)

GetWindowText() wants you to tell it the size of the buffer--including the
terminating NULL char--but we weren't counting that last char, losing the
last char of the string in the process. This was only seen with the special
case of SDL_CreateWindowFrom() to use an existing native window, not
the usual SDL_CreateWindow() codepath.

Fixes Bugzilla #4696.
  • Loading branch information
icculus committed Jun 26, 2019
1 parent 282b2b9 commit 0beadea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/video/windows/SDL_windowswindow.c
Expand Up @@ -386,7 +386,7 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
titleLen = GetWindowTextLength(hwnd);
title = SDL_small_alloc(TCHAR, titleLen + 1, &isstack);
if (title) {
titleLen = GetWindowText(hwnd, title, titleLen);
titleLen = GetWindowText(hwnd, title, titleLen + 1);
} else {
titleLen = 0;
}
Expand Down

0 comments on commit 0beadea

Please sign in to comment.