mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 08:50:25 +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;
|
FWindowHandle: HWND;
|
||||||
procedure SetControl(AControl: TControl);
|
procedure SetControl(AControl: TControl);
|
||||||
protected
|
protected
|
||||||
procedure SetHandle(NewHandle: HDC); override;
|
|
||||||
procedure CreateHandle; override;
|
procedure CreateHandle; override;
|
||||||
function GetDefaultColor(const ADefaultColorType: TDefaultColorType): TColor; override;
|
function GetDefaultColor(const ADefaultColorType: TDefaultColorType): TColor; override;
|
||||||
public
|
public
|
||||||
|
@ -27,13 +27,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
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;
|
function TControlCanvas.GetDefaultColor(const ADefaultColorType: TDefaultColorType): TColor;
|
||||||
begin
|
begin
|
||||||
if Assigned(FControl) then
|
if Assigned(FControl) then
|
||||||
@ -124,12 +117,12 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TControlCanvas.FreeHandle;
|
procedure TControlCanvas.FreeHandle;
|
||||||
begin
|
begin
|
||||||
|
inherited;
|
||||||
if FDeviceContext <> 0 then
|
if FDeviceContext <> 0 then
|
||||||
begin
|
begin
|
||||||
ReleaseDC(FWindowHandle, FDeviceContext);
|
ReleaseDC(FWindowHandle, FDeviceContext);
|
||||||
FDeviceContext := 0;
|
FDeviceContext := 0;
|
||||||
end;
|
end;
|
||||||
inherited;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TControlCanvas.ControlIsPainting: boolean;
|
function TControlCanvas.ControlIsPainting: boolean;
|
||||||
|
@ -6315,7 +6315,6 @@ end;
|
|||||||
procedure TWinControl.RemoveControl(AControl: TControl);
|
procedure TWinControl.RemoveControl(AControl: TControl);
|
||||||
var
|
var
|
||||||
AWinControl: TWinControl;
|
AWinControl: TWinControl;
|
||||||
AGrControl: TGraphicControl;
|
|
||||||
begin
|
begin
|
||||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.RemoveControl'){$ENDIF};
|
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.RemoveControl'){$ENDIF};
|
||||||
try
|
try
|
||||||
@ -6328,16 +6327,8 @@ begin
|
|||||||
AWinControl.DestroyHandle;
|
AWinControl.DestroyHandle;
|
||||||
end
|
end
|
||||||
else
|
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
|
if HandleAllocated then
|
||||||
AControl.InvalidateControl(AControl.IsVisible, False, True);
|
AControl.InvalidateControl(AControl.IsVisible, False, True);
|
||||||
end;
|
|
||||||
Remove(AControl);
|
Remove(AControl);
|
||||||
Perform(CM_CONTROLLISTCHANGE, WParam(AControl), LParam(False));
|
Perform(CM_CONTROLLISTCHANGE, WParam(AControl), LParam(False));
|
||||||
if not (csDestroying in ComponentState) then
|
if not (csDestroying in ComponentState) then
|
||||||
|
Loading…
Reference in New Issue
Block a user