mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-23 12:59:29 +01:00
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:
parent
dacdba13ad
commit
c99a91c256
@ -927,7 +927,8 @@ type
|
||||
AppNoExceptionMessages,
|
||||
AppActive, // application has focus
|
||||
AppDestroying,
|
||||
AppDoNotCallAsyncQueue
|
||||
AppDoNotCallAsyncQueue,
|
||||
AppInitialized // initialization of application was done
|
||||
);
|
||||
TApplicationFlags = set of TApplicationFlag;
|
||||
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user