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
Classes, SysUtils, FileUtil, Forms, Controls, lcltype, Graphics, SynEditKeyCmds,
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_sharedres, u_controls, u_writableComponent, u_dsgncontrols, LMessages;
@ -454,7 +454,11 @@ end;
function TEditorWidget.closeQuery: boolean;
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;
procedure TEditorWidget.setToolBarFlat(value: boolean);

View File

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