From 09b0509b084db974e0b7e19a267a52bce83b20d1 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 23 Sep 2008 18:42:29 +0000 Subject: [PATCH] 2008-09-23 20:41 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/vm/extrap.c ! Fixed to close .log file before showing MessageBox(). [TOMERGE 1.0] + Don't attempt to write into .log file if the _SET_HBOUTLOG filename is empty. ; TOFIX: Remove all remaining MessageBox() calls from Harbour sources. --- harbour/ChangeLog | 11 ++++++ harbour/source/vm/extrap.c | 72 +++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 36 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 11a39eecd0..320d7cc5e0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-09-23 20:41 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * source/vm/extrap.c + ! Fixed to close .log file before showing MessageBox(). + [TOMERGE 1.0] + + + Don't attempt to write into .log file if the _SET_HBOUTLOG + filename is empty. + + ; TOFIX: Remove all remaining MessageBox() calls from + Harbour sources. + 2008-09-23 18:56 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/rddads/adsmgmnt.c ! Blind fix to ADSMGGETWORKERTHREADACTIVITY() where the diff --git a/harbour/source/vm/extrap.c b/harbour/source/vm/extrap.c index 9c54d907e5..c05bca2e45 100644 --- a/harbour/source/vm/extrap.c +++ b/harbour/source/vm/extrap.c @@ -95,7 +95,7 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf USHORT uiLine; int iLevel; - FILE * hLog = hb_fopen( hb_setGetCPtr( HB_SET_HBOUTLOG ), "a+" ); + FILE * hLog = *hb_setGetCPtr( HB_SET_HBOUTLOG ) ? hb_fopen( hb_setGetCPtr( HB_SET_HBOUTLOG ), "a+" ) : NULL; if( hLog ) { @@ -215,6 +215,12 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf ptr += strlen( ptr ); } + if( hLog ) + { + fprintf( hLog, "------------------------------------------------------------------------\n"); + fclose( hLog ); + } + /* GUI */ { LPTSTR lpStr = HB_TCHAR_CONVTO( msg ); @@ -222,18 +228,12 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf HB_TCHAR_FREE( lpStr ); } - if( hLog ) - { - fprintf( hLog, "------------------------------------------------------------------------\n"); - fclose( hLog ); - } - return EXCEPTION_CONTINUE_SEARCH; /* EXCEPTION_EXECUTE_HANDLER; */ } #elif defined(HB_OS_OS2) -static EXCEPTIONREGISTRATIONRECORD s_regRec; /* Exception Registration Record */ +static EXCEPTIONREGISTRATIONRECORD s_regRec; /* Exception Registration Record */ ULONG _System hb_os2ExceptionHandler( PEXCEPTIONREPORTRECORD p1, PEXCEPTIONREGISTRATIONRECORD p2, @@ -260,7 +260,7 @@ ULONG _System hb_os2ExceptionHandler( PEXCEPTIONREPORTRECORD p1, fprintf( stderr, HB_I_("Called from %s(%hu)%s%s\n"), buffer, uiLine, *file ? HB_I_(" in ") : "", file ); } - return XCPT_CONTINUE_SEARCH; /* Exception not resolved... */ + return XCPT_CONTINUE_SEARCH; /* Exception not resolved... */ } #elif defined( HB_SIGNAL_EXCEPTION_HANDLER ) @@ -268,38 +268,38 @@ ULONG _System hb_os2ExceptionHandler( PEXCEPTIONREPORTRECORD p1, static void hb_signalExceptionHandler( int sig, siginfo_t * si, void * ucp ) { char buffer[ 32 ]; - const char *signame; - const char *sigaddr; + const char * signame; + const char * sigaddr; HB_SYMBOL_UNUSED( ucp ); switch( sig ) { - case SIGSEGV: - signame = "SIGSEGV"; - snprintf( buffer, sizeof( buffer ), "%p", si->si_addr ); - sigaddr = buffer; - break; - case SIGILL: - signame = "SIGILL"; - snprintf( buffer, sizeof( buffer ), "%p", si->si_addr ); - sigaddr = buffer; - break; - case SIGFPE: - signame = "SIGFPE"; - snprintf( buffer, sizeof( buffer ), "%p", si->si_addr ); - sigaddr = buffer; - break; - case SIGBUS: - signame = "SIGBUS"; - snprintf( buffer, sizeof( buffer ), "%p", si->si_addr ); - sigaddr = buffer; - break; - default: - snprintf( buffer, sizeof( buffer ), "sig:%d", sig ); - signame = buffer; - sigaddr = "UNKNOWN"; - break; + case SIGSEGV: + signame = "SIGSEGV"; + snprintf( buffer, sizeof( buffer ), "%p", si->si_addr ); + sigaddr = buffer; + break; + case SIGILL: + signame = "SIGILL"; + snprintf( buffer, sizeof( buffer ), "%p", si->si_addr ); + sigaddr = buffer; + break; + case SIGFPE: + signame = "SIGFPE"; + snprintf( buffer, sizeof( buffer ), "%p", si->si_addr ); + sigaddr = buffer; + break; + case SIGBUS: + signame = "SIGBUS"; + snprintf( buffer, sizeof( buffer ), "%p", si->si_addr ); + sigaddr = buffer; + break; + default: + snprintf( buffer, sizeof( buffer ), "sig:%d", sig ); + signame = buffer; + sigaddr = "UNKNOWN"; + break; } hb_errInternal( 6005, "Exception %s at address %s", signame, sigaddr );