cocoa: Patch from issue #28511 potential listview mem leak

git-svn-id: trunk@49631 -
This commit is contained in:
sekelsenmat 2015-08-10 18:32:52 +00:00
parent 758c2b909b
commit ffae572f14

View File

@ -560,11 +560,18 @@ begin
WriteLn('[TCocoaWSCustomListView.CreateHandle] AWinControl='+IntToStr(PtrInt(AWinControl))); WriteLn('[TCocoaWSCustomListView.CreateHandle] AWinControl='+IntToStr(PtrInt(AWinControl)));
{$ENDIF} {$ENDIF}
lCocoaLV := TCocoaListView.alloc.lclInitWithCreateParams(AParams); lCocoaLV := TCocoaListView.alloc.lclInitWithCreateParams(AParams);
ns := GetNSRect(0, 0, AParams.Width, AParams.Height);
lTableLV := TCocoaTableListView.alloc.initWithFrame(ns);
Result := TLCLIntfHandle(lCocoaLV); Result := TLCLIntfHandle(lCocoaLV);
if Result <> 0 then if Result <> 0 then
begin begin
ns := GetNSRect(0, 0, AParams.Width, AParams.Height);
lTableLV := TCocoaTableListView.alloc.initWithFrame(ns);
if lTableLV = nil then
begin
lCocoaLV.dealloc;
Result := 0;
exit;
end;
// Unintuitive things about NSTableView which caused a lot of headaches: // Unintuitive things about NSTableView which caused a lot of headaches:
// 1-> The column header appears only if the NSTableView is inside a NSScrollView // 1-> The column header appears only if the NSTableView is inside a NSScrollView
// 2-> To get proper scrolling use NSScrollView.setDocumentView instead of addSubview // 2-> To get proper scrolling use NSScrollView.setDocumentView instead of addSubview