macOS: Fix an abort due to an assertion when a program tries to set an invalid window title

Fixes #7271
This commit is contained in:
Kovid Goyal
2024-03-27 19:02:43 +05:30
parent e5a7554c30
commit 8335a5212e
4 changed files with 9 additions and 2 deletions

View File

@@ -1963,9 +1963,11 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
window->ns.object = nil;
}
void _glfwPlatformSetWindowTitle(_GLFWwindow* window UNUSED, const char* title)
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
{
if (!title) return;
NSString* string = @(title);
if (!string) return; // the runtime failed to convert title to an NSString
[window->ns.object setTitle:string];
// HACK: Set the miniwindow title explicitly as setTitle: doesn't update it
// if the window lacks NSWindowStyleMaskTitled