CtrlLib: HeaderCtrl now ignores serialization when number of columns is different #898

git-svn-id: svn://ultimatepp.org/upp/trunk@7839 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-10-30 09:02:04 +00:00
parent 7bc4483a57
commit 48fac7f2bb

View file

@ -741,23 +741,26 @@ void HeaderCtrl::Serialize(Stream& s) {
if(version >= 0x04) {
int n = col.GetCount();
s / n;
Array<Column> col2 = clone(col);
if(s.IsLoading())
col.InsertN(0, n);
col2.InsertN(0, n);
for(int i = 0; i < n; i++) {
int ndx = col[i].index;
int ndx = col2[i].index;
s % ndx;
if(s.IsLoading())
for(int j = n; j < col.GetCount(); j++)
if(col[j].index == ndx) {
col.Swap(i, j);
for(int j = n; j < col2.GetCount(); j++)
if(col2[j].index == ndx) {
col2.Swap(i, j);
break;
}
col[i].index = ndx;
s % col[i].ratio;
s % col[i].visible;
col2[i].index = ndx;
s % col2[i].ratio;
s % col2[i].visible;
}
if(s.IsLoading() && n == col.GetCount()) {
col2.Trim(n);
col = pick(col2);
}
if(s.IsLoading())
col.Trim(n);
}
else
if(version < 0x01) {