From d03e0d3bfb1a349a9431cb12969498e2a6d24411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1roly=20Balogh?= Date: Sun, 7 Jan 2018 16:17:00 +0000 Subject: [PATCH] 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 - --- rtl/palmos/si_prc.pp | 17 ++++++++++++----- rtl/palmos/system.pp | 6 ------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/rtl/palmos/si_prc.pp b/rtl/palmos/si_prc.pp index 3b0ec8ff4a..c37c564e51 100644 --- a/rtl/palmos/si_prc.pp +++ b/rtl/palmos/si_prc.pp @@ -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; diff --git a/rtl/palmos/system.pp b/rtl/palmos/system.pp index b125416596..5948793cfe 100644 --- a/rtl/palmos/system.pp +++ b/rtl/palmos/system.pp @@ -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;