mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 08:58:23 +02:00
revert r52494, r52500 #48fe37a204: they caused crashes in Carbon interface. Issue #30003
git-svn-id: trunk@52703 -
This commit is contained in:
parent
366cedfb91
commit
a55241308e
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user