fix possible "InvalidatePreferredSize loop detected" err msg after startup

This commit is contained in:
Basile Burg 2019-01-15 16:48:03 +01:00
parent 6d1fe59a8c
commit 4a65a77468
2 changed files with 11 additions and 5 deletions

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, lcltype, Graphics, SynEditKeyCmds, Classes, SysUtils, FileUtil, Forms, Controls, lcltype, Graphics, SynEditKeyCmds,
ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs, LazFileUtils, ComCtrls, SynEditHighlighter, ExtCtrls, Menus, SynMacroRecorder, dialogs, LazFileUtils,
SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, u_dialogs, SynPluginSyncroEdit, SynEdit, SynHighlighterMulti, AnchorDocking, u_dialogs,
u_widget, u_interfaces, u_synmemo, u_dlang, u_common, u_dcd, u_observer, u_widget, u_interfaces, u_synmemo, u_dlang, u_common, u_dcd, u_observer,
u_sharedres, u_controls, u_writableComponent, u_dsgncontrols, LMessages; u_sharedres, u_controls, u_writableComponent, u_dsgncontrols, LMessages;
@ -454,7 +454,11 @@ end;
function TEditorWidget.closeQuery: boolean; function TEditorWidget.closeQuery: boolean;
begin begin
result := inherited and Parent.isNil; result := inherited and (Parent.isNil or
// already set as dockable but not docked
// necessary because it has te closed programmatically during loading sequence
// otherwise the layout reloading has no effect.
Parent is TAnchorDockHostSite and Parent.Parent.isNil);
end; end;
procedure TEditorWidget.setToolBarFlat(value: boolean); procedure TEditorWidget.setToolBarFlat(value: boolean);

View File

@ -1898,8 +1898,8 @@ var
x: TXMLConfigStorage; x: TXMLConfigStorage;
s: TMemoryStream; s: TMemoryStream;
f: string; f: string;
t: string;
i: integer; i: integer;
w: TDexedWidget;
begin begin
result := false; result := false;
f := getDocPath + 'docking.xml'; f := getDocPath + 'docking.xml';
@ -1920,8 +1920,10 @@ begin
x := TXMLConfigStorage.Create(f, true); x := TXMLConfigStorage.Create(f, true);
try try
try try
DockMaster.CloseAll; // without this the relaoding fails
self.Visible:=true; // see https://bugs.freepascal.org/view.php?id=34454
for w in fWidgList do
w.Close;
DockMaster.LoadLayoutFromConfig(x, false); DockMaster.LoadLayoutFromConfig(x, false);
except except
exit; exit;