B2016-130: fix crash on working with iteminfolists (inserting into list when it should not)
This commit is contained in:
parent
e702d5d8fc
commit
21fe413ff9
@ -59,6 +59,7 @@ namespace VEPROMS.CSLA.Library
|
||||
RefreshingList = false;
|
||||
}
|
||||
}
|
||||
// sender can be either the current item changed, or the current item with one added before it (when an item is inserted)
|
||||
void tmp_Changed(object sender)
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
@ -68,8 +69,11 @@ namespace VEPROMS.CSLA.Library
|
||||
// Added insert to fix when item is replaced and a 'delete' is done, the item needs inserted. Note
|
||||
// that when text is modified, i.e. 'Changed', this code is not executed. Fixed B2016-130.
|
||||
RefreshingList = true;
|
||||
IsReadOnly = false;
|
||||
Items.Insert(i, (sender as ItemInfo).MyPrevious);
|
||||
IsReadOnly = false;
|
||||
// the following checks to see if the previous is this one, and if so, it is not an insert it is a change
|
||||
// On an insert, inserting from 'sender', MyPrevious is set as the new item.
|
||||
if (SourceOfList != "Search" && (sender as ItemInfo).MyPrevious != null && i > 0 && base[i - 1].ItemID != (sender as ItemInfo).MyPrevious.ItemID)
|
||||
Items.Insert(i, (sender as ItemInfo).MyPrevious);
|
||||
IsReadOnly = true;
|
||||
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
|
||||
RefreshingList = false;
|
||||
@ -77,6 +81,20 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
private string _SourceOfList;
|
||||
public string SourceOfList
|
||||
{
|
||||
get { return _SourceOfList; }
|
||||
set { _SourceOfList = value; }
|
||||
}
|
||||
//private void ShowList(string txt)
|
||||
//{
|
||||
// Console.WriteLine("\r\n{0} - {1} - {2}: i, base[i].Ordinal, base[i].ItemID, base[i].DisplayText", txt, Count, SourceOfList);
|
||||
// for (int i = 0; i < Count; i++)
|
||||
// {
|
||||
// Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", i, base[i].Ordinal, base[i].ItemID, base[i].DisplayText, base[i].MyItemInfoUnique, base[i].Disposed);
|
||||
// }
|
||||
//}
|
||||
private bool _Disposed = false;
|
||||
private static int _CountCreated = 0;
|
||||
private static int _CountDisposed = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user