From 55c4e2ffe81b2fc999eead836042fda71d8f7673 Mon Sep 17 00:00:00 2001 From: rich2014 Date: Wed, 7 Aug 2024 22:21:29 +0800 Subject: [PATCH] Cocoa: unify window titles --- lcl/interfaces/cocoa/cocoawsforms.pas | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoawsforms.pas b/lcl/interfaces/cocoa/cocoawsforms.pas index 0bbfad18fc..c3b562c6b5 100644 --- a/lcl/interfaces/cocoa/cocoawsforms.pas +++ b/lcl/interfaces/cocoa/cocoawsforms.pas @@ -792,9 +792,8 @@ begin cb.window := win; win.setDelegate(win); - ns := NSStringUtf8(AWinControl.Caption); + ns := ControlTitleToNSStr( AWinControl.Caption ); win.setTitle(ns); - ns.release; {$ifdef BOOLFIX} win.setReleasedWhenClosed_(Ord(False)); // do not release automatically win.setAcceptsMouseMovedEvents_(Ord(True)); @@ -939,12 +938,11 @@ begin if not AWinControl.HandleAllocated then Exit; win := TCocoaWindowContent(AWinControl.Handle).lclOwnWindow; - ns := NSStringUtf8(AText); + ns := ControlTitleToNSStr( AText ); if Assigned(win) then NSwindow(win).setTitle(ns) else TCocoaWindowContent(AWinControl.Handle).setStringValue(ns); - ns.release; end; class procedure TCocoaWSCustomForm.CloseModal(const ACustomForm: TCustomForm);