palmos: bail out earlier when we're not in NormalLaunch mode, should fix Fatal Exception crash when installing the app on a real device using HotSync

git-svn-id: trunk@37931 -
This commit is contained in:
Károly Balogh 2018-01-07 16:17:00 +00:00
parent 0f0bdabb89
commit d03e0d3bfb
2 changed files with 12 additions and 11 deletions

View File

@ -35,7 +35,6 @@ var
procedure PascalMain; external name 'PASCALMAIN';
procedure FPCRelocateData; forward;
{ this function must be the first in this unit which contains code }
function _FPC_proc_start: longint; cdecl; public name '_start';
var
@ -43,6 +42,8 @@ var
prevGlobals: Pointer;
globalsPtr: Pointer;
begin
_FPC_proc_start:=0;
if SysAppStartup(locAppInfo, prevGlobals, globalsPtr) <> 0 then
begin
SndPlaySystemSound(sndError);
@ -52,13 +53,19 @@ begin
if (locAppInfo^.launchFlags and sysAppLaunchFlagNewGlobals) > 0 then
FPCRelocateData;
if setjmp(sysinit_jmpbuf) = 0 then
{ we don't support anything but normal startup now }
{ FIXME: figure it out how various startup commands can }
{ coexist with the normal system unit infrastructure (KB) }
if locAppInfo^.cmd = sysAppLaunchCmdNormalLaunch then
begin
appInfo:=locAppInfo;
PascalMain;
if setjmp(sysinit_jmpbuf) = 0 then
begin
appInfo:=locAppInfo;
PascalMain;
end;
_FPC_proc_start:=ExitCode;
end;
_FPC_proc_start:=ExitCode;
SysAppExit(locAppInfo, prevGlobals, globalsPtr);
end;

View File

@ -147,12 +147,6 @@ begin
{ Initialize ExitProc }
ExitProc:=Nil;
{ we don't support anything but normal startup now }
{ FIXME: lets figure it out how various startup modes }
{ can coexist with the system unit infrastructure (KB) }
if not (palmAppInfo^.cmd = sysAppLaunchCmdNormalLaunch) then
halt(0);
SysInitExceptions;
{$ifdef FPC_HAS_FEATURE_UNICODESTRINGS}
InitUnicodeStringManager;