From 1a02ce4bc11658df9f1534741e0a1ff8285bdd64 Mon Sep 17 00:00:00 2001 From: daniel Date: Sun, 26 Nov 2006 18:50:21 +0000 Subject: [PATCH] * Prevent IDE from crashing when receiving a signal if displaying user screen. * Prevent ctrl+c being delivered as SIGINT to IDE when running user program. git-svn-id: trunk@5496 - --- ide/Makefile | 24 +++--------------------- ide/fp.pas | 13 ++++++++++--- ide/fpide.pas | 5 +++++ ide/fpredir.pas | 5 +++-- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/ide/Makefile b/ide/Makefile index 99c9c63a5b..011004050c 100644 --- a/ide/Makefile +++ b/ide/Makefile @@ -1,8 +1,8 @@ # -# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/02] +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/06/20] # default: all -MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux +MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux BSDs = freebsd netbsd openbsd darwin UNIXs = linux $(BSDs) solaris qnx LIMIT83fs = go32v2 os2 emx watcom @@ -332,9 +332,6 @@ endif ifeq ($(FULL_TARGET),powerpc-netbsd) override TARGET_DIRS+=compiler endif -ifeq ($(FULL_TARGET),powerpc-amiga) -override TARGET_DIRS+=compiler -endif ifeq ($(FULL_TARGET),powerpc-macos) override TARGET_DIRS+=compiler endif @@ -455,9 +452,6 @@ endif ifeq ($(FULL_TARGET),powerpc-netbsd) override TARGET_PROGRAMS+=fp endif -ifeq ($(FULL_TARGET),powerpc-amiga) -override TARGET_PROGRAMS+=fp -endif ifeq ($(FULL_TARGET),powerpc-macos) override TARGET_PROGRAMS+=fp endif @@ -580,9 +574,6 @@ endif ifeq ($(FULL_TARGET),powerpc-netbsd) override COMPILER_OPTIONS+=-Sg endif -ifeq ($(FULL_TARGET),powerpc-amiga) -override COMPILER_OPTIONS+=-Sg -endif ifeq ($(FULL_TARGET),powerpc-macos) override COMPILER_OPTIONS+=-Sg endif @@ -1050,7 +1041,7 @@ endif ifeq ($(OS_TARGET),amiga) EXEEXT= PPUEXT=.ppu -ASMEXT=.s +ASMEXT=.asm OEXT=.o SMARTEXT=.sl STATICLIBEXT=.a @@ -1556,12 +1547,6 @@ REQUIRE_PACKAGES_FV=1 REQUIRE_PACKAGES_GDBINT=1 REQUIRE_PACKAGES_REGEXPR=1 endif -ifeq ($(FULL_TARGET),powerpc-amiga) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_FV=1 -REQUIRE_PACKAGES_GDBINT=1 -REQUIRE_PACKAGES_REGEXPR=1 -endif ifeq ($(FULL_TARGET),powerpc-macos) REQUIRE_PACKAGES_RTL=1 REQUIRE_PACKAGES_FV=1 @@ -2395,9 +2380,6 @@ endif ifeq ($(FULL_TARGET),powerpc-netbsd) TARGET_DIRS_COMPILER=1 endif -ifeq ($(FULL_TARGET),powerpc-amiga) -TARGET_DIRS_COMPILER=1 -endif ifeq ($(FULL_TARGET),powerpc-macos) TARGET_DIRS_COMPILER=1 endif diff --git a/ide/fp.pas b/ide/fp.pas index c4ecaaa7ac..6ed0bde6ee 100644 --- a/ide/fp.pas +++ b/ide/fp.pas @@ -206,7 +206,7 @@ begin end; if ErrS<>'' then begin - if Assigned(Application) then + if (application<>nil) and (ideapp.displaymode=dmIDE) then ErrorBox('Stream error: '+#13+ErrS,nil) else @@ -408,7 +408,7 @@ BEGIN { If ExitProc=@InterceptExit then ExitProc:=StoreExitProc;} Str(SeenExitCode,ErrS); - if Assigned(Application) then + if (application<>nil) and (ideapp.displaymode=dmIDE) then begin P.l1:=SeenExitCode; ErrS:=hexstr(longint(SeenErrorAddr),8); @@ -423,7 +423,7 @@ BEGIN begin Str(SetJmpRes,ErrS); { Longjmp was called by fpcatch } - if Assigned(Application) then + if (application<>nil) and (ideapp.displaymode=dmIDE) then begin P.l1:=SetJmpRes; if OKCancelBox(error_programexitedwithsignal,@P)=cmCancel then @@ -432,7 +432,14 @@ BEGIN else writeln('Signal error: ',ErrS); end; + if ideapp.displaymode=dmUser then + begin + writeln('Fatal exception occured while in user screen mode. File save message boxes'); + writeln('cannot be displayed. We are sorry, but need to terminate now.'); + halt(255); + end; end; + if (AutoSaveOptions and asEditorFiles)=0 then CanExit:=IDEApp.AskSaveAll else diff --git a/ide/fpide.pas b/ide/fpide.pas index b93d17dfc6..0f85478a96 100644 --- a/ide/fpide.pas +++ b/ide/fpide.pas @@ -26,9 +26,11 @@ uses type TExecType = (exNormal,exNoSwap,exDosShell); + Tdisplaymode = (dmIDE,dmUser); TIDEApp = object(TApplication) IsRunning : boolean; + displaymode : Tdisplaymode; constructor Init; procedure InitDesktop; virtual; procedure LoadMenuBar; @@ -263,6 +265,7 @@ end; constructor TIDEApp.Init; var R: TRect; begin + displaymode:=dmIDE; UseSyntaxHighlight:=@IDEUseSyntaxHighlight; UseTabsPattern:=@IDEUseTabsPattern; inherited Init; @@ -879,6 +882,7 @@ end; procedure TIDEApp.ShowUserScreen; begin + displaymode:=dmUser; if Assigned(UserScreen) then UserScreen^.SaveIDEScreen; DoneSysError; @@ -942,6 +946,7 @@ begin UpdateScreen(true); {$endif go32v2} {$endif Windows} + displaymode:=dmIDE; end; function TIDEApp.AutoSave: boolean; diff --git a/ide/fpredir.pas b/ide/fpredir.pas index 1f9ab739ee..edfd2dd90c 100644 --- a/ide/fpredir.pas +++ b/ide/fpredir.pas @@ -940,10 +940,11 @@ end; SmallHeap; {$EndIf MsDos} SwapVectors; - { Must use shell() for linux for the wildcard expansion (PFV) } {$ifdef UNIX} IOStatus:=0; - ExecuteResult:=Shell(MaybeQuoted(FixPath(Progname))+' '+Comline); + {We need to use fpsystem to get wildcard expansion and avoid being + interrupted by ctrl+c (SIGINT).}; + ExecuteResult:=fpsystem(MaybeQuoted(FixPath(Progname))+' '+Comline); if ExecuteResult<0 then begin IOStatus:=(-ExecuteResult) and $7f;