From ed86a184979b4367d7ea0fc051a6a0c7939e9e43 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Sat, 3 Sep 2022 15:05:56 +0100 Subject: [PATCH] Used std::string to fix crash on grabbing mouse with Ctrl+F5 --- BasiliskII/src/SDL/video_sdl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index a2b39c77..7fd3a832 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef WIN32 #include /* alloca() */ @@ -537,11 +538,11 @@ static void set_window_name(bool mouse_grabbed) if (vi && vi->wm_available) { const char *title = PrefsFindString("title"); - char *str = (char *)(title ? title : GetString(STR_WINDOW_TITLE)); + std::string s = title ? title : GetString(STR_WINDOW_TITLE); if(grabbed) - strcat(str, GetString(grabbed)); + s += GetString(grabbed); //The icon name should stay the same - SDL_WM_SetCaption(str, GetString(STR_WINDOW_TITLE)); + SDL_WM_SetCaption(s.c_str(), GetString(STR_WINDOW_TITLE)); } }