mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 23:00:35 +02:00
Merge branch 'cocoa/control/combobox' into 'main'
FIX #39965: COCOA: the issue of Items in ComboBox released too early, fixed to release in dealloc See merge request freepascal.org/lazarus/lazarus!117
This commit is contained in:
commit
c19c4b20b9
@ -1451,6 +1451,7 @@ end;
|
||||
|
||||
procedure TCocoaComboBox.dealloc;
|
||||
begin
|
||||
FreeAndNil( list );
|
||||
if Assigned(resultNS) then resultNS.release;
|
||||
inherited dealloc;
|
||||
end;
|
||||
|
@ -93,6 +93,7 @@ type
|
||||
class procedure SetDropDownCount(const ACustomComboBox: TCustomComboBox; NewCount: Integer); override;
|
||||
|
||||
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override;
|
||||
class procedure FreeItems(var AItems: TStrings); override;
|
||||
{class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); override;}
|
||||
|
||||
class function GetItemHeight(const ACustomComboBox: TCustomComboBox): Integer; override;
|
||||
@ -1974,6 +1975,15 @@ begin
|
||||
Result:=TCocoaComboBox(ACustomComboBox.Handle).list;
|
||||
end;
|
||||
|
||||
class procedure TCocoaWSCustomComboBox.FreeItems(var AItems: TStrings);
|
||||
begin
|
||||
// in Cocoa, TCocoaComboBox.list should be released in TCocoaComboBox.dealloc(),
|
||||
// to avoid invalid TCocoaComboBox.list in TCocoaComboBox.comboBox_indexOfItemWithStringValue().
|
||||
// which will be called even in TCocoaWSWinControl.DestoryWnd(),
|
||||
// when TCocoaComboBox hasMarkedText (in IME state).
|
||||
// after all, it is more appropriate to release with other resources in dealloc().
|
||||
end;
|
||||
|
||||
class function TCocoaWSCustomComboBox.GetItemHeight(const ACustomComboBox:
|
||||
TCustomComboBox):Integer;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user