From 5f76c9b083d73de7d79a10a86c9d977cb4aeaba4 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 4 Sep 2008 12:15:08 +0000 Subject: [PATCH] win32: TCustomListBox: don't recreateWnd if we are destroying handle git-svn-id: trunk@16410 - --- lcl/include/customlistbox.inc | 2 +- lcl/interfaces/win32/win32listsl.inc | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lcl/include/customlistbox.inc b/lcl/include/customlistbox.inc index 896eb14cea..4da151d2db 100644 --- a/lcl/include/customlistbox.inc +++ b/lcl/include/customlistbox.inc @@ -139,7 +139,7 @@ begin GetItemIndex; //DebugLn('[TCustomListBox.FinalizeWnd] A ',FItems.ClassName); // create internal item list - if Assigned(FItems) then begin; + if Assigned(FItems) then begin NewStrings:= TExtendedStringList.Create(GetCachedDataSize); // copy items (text+objects) from the interface items list diff --git a/lcl/interfaces/win32/win32listsl.inc b/lcl/interfaces/win32/win32listsl.inc index 36f6eaff2c..63f071e416 100644 --- a/lcl/interfaces/win32/win32listsl.inc +++ b/lcl/interfaces/win32/win32listsl.inc @@ -93,11 +93,12 @@ End; ------------------------------------------------------------------------------} procedure TWin32ListStringList.Sort; -Begin +begin // The win api doesn't allow to change the sort on the fly, // so is needed to recreate the window - RecreateWnd(FSender); -End; + if not (csDestroyingHandle in FSender.ControlState) then + RecreateWnd(FSender); +end; {------------------------------------------------------------------------------