diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 6cb02f8b46..a48aaf7eb3 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -2901,11 +2901,8 @@ begin Application.ModalStarted; try Include(FFormState, fsModal); - if PopupMode = pmNone then - begin - RecreateWnd(Self); - HandleNeeded; - end; + if (PopupMode = pmNone) and HandleAllocated then + RecreateWnd(Self); // need to refresh handle for pmNone because ParentWindow changes if (fsModal in FFormState) - see GetRealPopupParent ActiveWindow := GetActiveWindow; SavedFocusState := SaveFocusState; SavedCursor := Screen.Cursor;