revert r52494, r52500 #48fe37a204: they caused crashes in Carbon interface. Issue #30003

git-svn-id: trunk@52703 -
This commit is contained in:
ondrej 2016-07-17 04:12:46 +00:00
parent 366cedfb91
commit a55241308e
3 changed files with 1 additions and 18 deletions

View File

@ -304,7 +304,6 @@ type
FWindowHandle: HWND;
procedure SetControl(AControl: TControl);
protected
procedure SetHandle(NewHandle: HDC); override;
procedure CreateHandle; override;
function GetDefaultColor(const ADefaultColorType: TDefaultColorType): TColor; override;
public

View File

@ -27,13 +27,6 @@ begin
end;
end;
procedure TControlCanvas.SetHandle(NewHandle: HDC);
begin
if NewHandle=0 then // don't allow to clear handle if there's valid FDeviceContext - otherwise it doesn't get freed!
NewHandle := FDeviceContext;
inherited SetHandle(NewHandle);
end;
function TControlCanvas.GetDefaultColor(const ADefaultColorType: TDefaultColorType): TColor;
begin
if Assigned(FControl) then
@ -124,12 +117,12 @@ end;
------------------------------------------------------------------------------}
procedure TControlCanvas.FreeHandle;
begin
inherited;
if FDeviceContext <> 0 then
begin
ReleaseDC(FWindowHandle, FDeviceContext);
FDeviceContext := 0;
end;
inherited;
end;
function TControlCanvas.ControlIsPainting: boolean;

View File

@ -6315,7 +6315,6 @@ end;
procedure TWinControl.RemoveControl(AControl: TControl);
var
AWinControl: TWinControl;
AGrControl: TGraphicControl;
begin
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.RemoveControl'){$ENDIF};
try
@ -6328,16 +6327,8 @@ begin
AWinControl.DestroyHandle;
end
else
begin
if AControl is TGraphicControl then
begin
AGrControl := TGraphicControl(AControl);
if (AGrControl.Canvas<>nil) and AGrControl.Canvas.HandleAllocated then
TControlCanvas(AGrControl.Canvas).FreeHandle;
end;
if HandleAllocated then
AControl.InvalidateControl(AControl.IsVisible, False, True);
end;
Remove(AControl);
Perform(CM_CONTROLLISTCHANGE, WParam(AControl), LParam(False));
if not (csDestroying in ComponentState) then