From ab2247f8f38198b97c43b0d9a51cbe1e8ce4ea99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 6 Aug 2017 23:04:19 +0200 Subject: [PATCH] Cocoa: Fix string object being updated incorrectly Fixes #1050. --- README.md | 1 + src/cocoa_window.m | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3353dacc..260818c8 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ information on what to include when reporting a bug. - [Cocoa] Bugfix: Value range was ignored for joystick hats and buttons (#888) - [Cocoa] Bugfix: Full screen framebuffer was incorrectly sized for some video modes (#682) +- [Cocoa] Bugfix: A string object for IME was updated non-idiomatically (#1050) - [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts - [WGL] Added support for `WGL_ARB_create_context_no_error` - [GLX] Added support for `GLX_ARB_create_context_no_error` diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 2acfa98b..4c27c517 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -698,10 +698,11 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange { + [markedText release]; if ([string isKindOfClass:[NSAttributedString class]]) - [markedText initWithAttributedString:string]; + markedText = [[NSMutableAttributedString alloc] initWithAttributedString:string]; else - [markedText initWithString:string]; + markedText = [[NSMutableAttributedString alloc] initWithString:string]; } - (void)unmarkText