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 PascalMain; external name 'PASCALMAIN';
procedure FPCRelocateData; forward; procedure FPCRelocateData; forward;
{ this function must be the first in this unit which contains code } { this function must be the first in this unit which contains code }
function _FPC_proc_start: longint; cdecl; public name '_start'; function _FPC_proc_start: longint; cdecl; public name '_start';
var var
@ -43,6 +42,8 @@ var
prevGlobals: Pointer; prevGlobals: Pointer;
globalsPtr: Pointer; globalsPtr: Pointer;
begin begin
_FPC_proc_start:=0;
if SysAppStartup(locAppInfo, prevGlobals, globalsPtr) <> 0 then if SysAppStartup(locAppInfo, prevGlobals, globalsPtr) <> 0 then
begin begin
SndPlaySystemSound(sndError); SndPlaySystemSound(sndError);
@ -52,13 +53,19 @@ begin
if (locAppInfo^.launchFlags and sysAppLaunchFlagNewGlobals) > 0 then if (locAppInfo^.launchFlags and sysAppLaunchFlagNewGlobals) > 0 then
FPCRelocateData; 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 begin
appInfo:=locAppInfo; if setjmp(sysinit_jmpbuf) = 0 then
PascalMain; begin
appInfo:=locAppInfo;
PascalMain;
end;
_FPC_proc_start:=ExitCode;
end; end;
_FPC_proc_start:=ExitCode;
SysAppExit(locAppInfo, prevGlobals, globalsPtr); SysAppExit(locAppInfo, prevGlobals, globalsPtr);
end; end;

View File

@ -147,12 +147,6 @@ begin
{ Initialize ExitProc } { Initialize ExitProc }
ExitProc:=Nil; 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; SysInitExceptions;
{$ifdef FPC_HAS_FEATURE_UNICODESTRINGS} {$ifdef FPC_HAS_FEATURE_UNICODESTRINGS}
InitUnicodeStringManager; InitUnicodeStringManager;