diff --git a/lcl/include/customlistbox.inc b/lcl/include/customlistbox.inc index 76b51ec56b..9174b9c60f 100644 --- a/lcl/include/customlistbox.inc +++ b/lcl/include/customlistbox.inc @@ -100,6 +100,9 @@ var i, Cnt: integer; begin LockSelectionChange; + // save ItemIndex on destroy handle + if ([csDestroying,csLoading]*ComponentState=[]) then + GetItemIndex; //DebugLn('[TCustomListBox.DestroyHandle] A ',FItems.ClassName); // create internal item list NewStrings:= TExtendedStringList.Create(GetCachedDataSize);