lcl: don't show exception using forms while application is not initialized

- add new application flag AppInitialized,
  - check if application is initialized before trying to show exception message using MessageBox

git-svn-id: trunk@19019 -
This commit is contained in:
paul 2009-03-18 09:07:41 +00:00
parent dacdba13ad
commit c99a91c256
2 changed files with 9 additions and 7 deletions

View File

@ -927,7 +927,8 @@ type
AppNoExceptionMessages,
AppActive, // application has focus
AppDestroying,
AppDoNotCallAsyncQueue
AppDoNotCallAsyncQueue,
AppInitialized // initialization of application was done
);
TApplicationFlags = set of TApplicationFlag;

View File

@ -360,16 +360,17 @@ procedure TApplication.Initialize;
begin
inherited Initialize;
// interface object and screen
if (WidgetSet=nil)
// or (AnsiCompareText(WidgetSet.Classname,'TWIDGETSET')=0)
or (WidgetSet.ClassType = TWidgetSet)
if (WidgetSet=nil) or (WidgetSet.ClassType = TWidgetSet)
then begin
DebugLn('ERROR: ',rsNoWidgetSet);
raise Exception.Create(rsNoWidgetSet);
end;
WidgetSet.AppInit(ScreenInfo);
ScreenInfo.Initialized:=true;
ScreenInfo.Initialized := True;
Screen.UpdateScreen;
// set that we are initialized => all exceptions will be handled by our HandleException
include(FFlags, AppInitialized);
// application icon
if LazarusResources.Find('MAINICON') <> nil then
Icon.LoadFromLazarusResource('MAINICON');
@ -1358,8 +1359,8 @@ begin
if FindInvalidUTF8Character(pchar(Msg),length(Msg), False) > 0 then
Msg := AnsiToUtf8(Msg);
if (Msg <> '') and (Msg[length(Msg)] <> '.') then Msg := Msg + '.';
if (not Terminated)
and (Self<>nil) then begin
if (not Terminated) and (Self <> nil) and (AppInitialized in FFlags) then
begin
DisableIdleHandler;
try
MsgResult:=MessageBox(PChar(Format(