mirror of https://gitlab.com/basile.b/dexed.git
temp fix, docking, prevent any invalid layout to be saved
This commit is contained in:
parent
875a41d01f
commit
f74eaa0b75
|
@ -585,10 +585,21 @@ begin
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
forceDirectory(getCoeditDocPath);
|
forceDirectory(getCoeditDocPath);
|
||||||
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'docking.xml',false);
|
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'docking.xml.tmp', false);
|
||||||
try
|
try
|
||||||
DockMaster.SaveLayoutToConfig(xcfg);
|
DockMaster.SaveLayoutToConfig(xcfg);
|
||||||
xcfg.WriteToDisk;
|
xcfg.WriteToDisk;
|
||||||
|
// TODO: this when AnchorDocking wiont save anymore invalid layout
|
||||||
|
with TMemoryStream.Create do try
|
||||||
|
LoadFromFile(getCoeditDocPath + 'docking.xml.tmp');
|
||||||
|
if Size < 10000 then
|
||||||
|
begin
|
||||||
|
SaveToFile(getCoeditDocPath + 'docking.xml');
|
||||||
|
SysUtils.DeleteFile(getCoeditDocPath + 'docking.xml.tmp');
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
free;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
xcfg.Free;
|
xcfg.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -1455,7 +1466,6 @@ var
|
||||||
xcfg: TXMLConfigStorage;
|
xcfg: TXMLConfigStorage;
|
||||||
i: NativeInt;
|
i: NativeInt;
|
||||||
begin
|
begin
|
||||||
// TODO-cbugfix: possible loading AV, xml saved after undocking some widgets, xml file abnormal size, seems to be related to Anchordocking itself, not its usage.
|
|
||||||
for i:= 0 to fWidgList.Count-1 do
|
for i:= 0 to fWidgList.Count-1 do
|
||||||
begin
|
begin
|
||||||
if not fWidgList.widget[i].isDockable then continue;
|
if not fWidgList.widget[i].isDockable then continue;
|
||||||
|
@ -1466,10 +1476,24 @@ begin
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
forceDirectory(extractFilePath(aFilename));
|
forceDirectory(extractFilePath(aFilename));
|
||||||
xcfg := TXMLConfigStorage.Create(aFilename, false);
|
xcfg := TXMLConfigStorage.Create(aFilename + '.tmp', false);
|
||||||
try
|
try
|
||||||
DockMaster.SaveLayoutToConfig(xcfg);
|
DockMaster.SaveLayoutToConfig(xcfg);
|
||||||
xcfg.WriteToDisk;
|
xcfg.WriteToDisk;
|
||||||
|
// prevent any invalid layout to be saved (AnchorDocking bug)
|
||||||
|
// TODO: remove this when AnchorDocking wiont save anymore invalid layout
|
||||||
|
with TMemoryStream.Create do try
|
||||||
|
LoadFromFile(aFilename + '.tmp');
|
||||||
|
if Size < 10000 then
|
||||||
|
begin
|
||||||
|
SaveToFile(aFilename);
|
||||||
|
SysUtils.DeleteFile(aFilename + '.tmp');
|
||||||
|
end else
|
||||||
|
getMessageDisplay.message('prevented an invalid layout to be saved', nil,
|
||||||
|
amcApp, amkWarn);
|
||||||
|
finally
|
||||||
|
free;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
xcfg.Free;
|
xcfg.Free;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue