LCL: disabled exception for handle creation during loading, needed by glscene

git-svn-id: trunk@24382 -
This commit is contained in:
mattias 2010-04-03 19:51:51 +00:00
parent 2c6d401dc3
commit b1b4157851
3 changed files with 31 additions and 18 deletions

View File

@ -1007,10 +1007,19 @@ end;
procedure TCustomForm.SetParent(NewParent: TWinControl);
begin
if Parent=NewParent then exit;
if HandleAllocated then DestroyHandle;
inherited SetParent(NewParent);
if (Parent=nil) and Visible then
HandleNeeded;
{$IFNDEF OldAutoSize}
DisableAutoSizing;
{$ENDIF}
try
if HandleAllocated then DestroyHandle;
inherited SetParent(NewParent);
if (Parent=nil) and Visible then
HandleNeeded;
finally
{$IFNDEF OldAutoSize}
EnableAutoSizing;
{$ENDIF}
end;
end;
{------------------------------------------------------------------------------

View File

@ -2290,9 +2290,10 @@ begin
or ((not FShowing) and (not (csDesigning in ComponentState)))
// during handle creation no autosize
or (wcfCreatingChildHandles in FWinControlFlags)
or
{$ELSE}
(csDestroyingHandle in ControlState)
{$ENDIF}
(inherited AutoSizeDelayed);
or (inherited AutoSizeDelayed);
//if Result then debugln('TWinControl.AutoSizeDelayed A ',DbgSName(Self),' wcfCreatingChildHandles=',dbgs(wcfCreatingChildHandles in FWinControlFlags),' csLoading=',dbgs(csLoading in ComponentState));
{$IFDEF VerboseCanAutoSize}
if Result {and AutoSize} then begin
@ -5021,17 +5022,20 @@ begin
// First destroy all children handles
//DebugLn(['TWinControl.DestroyHandle DESTROY CHILDS ',DbgSName(Self)]);
Include(FControlState, csDestroyingHandle);
if FControls <> nil then begin
for i:= 0 to FControls.Count - 1 do begin
//DebugLn([' ',i,' ',DbgSName(TObject(FWinControls[i]))]);
AWinControl:=TWinControl(FControls[i]);
if (AWinControl is TWinControl) and AWinControl.HandleAllocated then
AWinControl.DestroyHandle;
try
if FControls <> nil then begin
for i:= 0 to FControls.Count - 1 do begin
//DebugLn([' ',i,' ',DbgSName(TObject(FWinControls[i]))]);
AWinControl:=TWinControl(FControls[i]);
if (AWinControl is TWinControl) and AWinControl.HandleAllocated then
AWinControl.DestroyHandle;
end;
end;
//DebugLn(['TWinControl.DestroyHandle DESTROY SELF ',DbgSName(Self)]);
DestroyWnd;
finally
Exclude(FControlState, csDestroyingHandle);
end;
//DebugLn(['TWinControl.DestroyHandle DESTROY SELF ',DbgSName(Self)]);
DestroyWnd;
Exclude(FControlState, csDestroyingHandle);
//DebugLn(['TWinControl.DestroyHandle END ',DbgSName(Self)]);
end;
@ -6030,12 +6034,14 @@ begin
AControl.Invalidate;
//DebugLn('TWinControl.InsertControl ',Name,':',ClassName);
end;
{$IFDEF OldAutoSize}
if not (csDestroying in ComponentState) then
begin
if not (csLoading in ComponentState) then
AControl.UpdateAnchorRules;
AControl.RequestAlign;
end;
{$ENDIF}
Perform(CM_CONTROLCHANGE, WParam(AControl), LParam(True));
{$IFNDEF OldAutoSize}
finally
@ -7053,9 +7059,6 @@ begin
if [csLoading,csDesigning]*ComponentState=[csLoading] then begin
DebugLn('[HINT] TWinControl.CreateWnd creating Handle during loading ',DbgSName(Self),' csDesigning=',dbgs(csDesigning in ComponentState));
{$IFNDEF OldAutoSize}
RaiseGDBException('');
{$ENDIF}
//DumpStack;
//RaiseGDBException('');
end;

View File

@ -6969,6 +6969,7 @@ begin
if GtkWidgetIsA(ParentFixed,GTK_FIXED_GET_TYPE) or
GtkWidgetIsA(ParentFixed,GTK_LAYOUT_GET_TYPE) then
begin
//DebugLn(['SetWidgetSizeAndPosition ',DbgSName(LCLControl),' Widget=[',GetWidgetDebugReport(Widget),'] ParentFixed=[',GetWidgetDebugReport(ParentFixed),']']);
FixedMoveControl(ParentFixed, Widget, LCLLeft, LCLTop);
end
else