diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d62570f059..4dba93ef47 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,14 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-02 21:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbpgsql/postgres.c + * contrib/hbpgsql/tests/test.prg + * Destructor PQCLOSETRACE() marked as deprecated, replaced in + test app with NIL assignment. + ! Fixes to FILE object type. + ; All this is only relevant if built with NODLL flag. + 2010-02-02 21:44 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbpgsql/postgres.c + Added GC support for all remaining pointer types (result/cancel/FILE). diff --git a/harbour/contrib/hbpgsql/postgres.c b/harbour/contrib/hbpgsql/postgres.c index f998efd9c1..bc2a40f3f5 100644 --- a/harbour/contrib/hbpgsql/postgres.c +++ b/harbour/contrib/hbpgsql/postgres.c @@ -235,7 +235,7 @@ static HB_GARBAGE_FUNC( FILE_release ) if( ph && * ph ) { /* Destroy the object */ - PQclear( ( FILE * ) * ph ); + fclose( ( FILE * ) * ph ); /* set pointer to NULL to avoid multiple freeing */ * ph = NULL; @@ -1034,15 +1034,21 @@ HB_FUNC( PQCREATETRACE ) #endif } +/* NOTE: Deprecated */ HB_FUNC( PQCLOSETRACE ) { #ifdef NODLL - FILE * trfile = hb_FILE_par( 1 ); + void ** ph = ( void ** ) hb_parptrGC( &s_gcFILEFuncs, 1 ); - if( trfile ) - fclose( trfile ); - else - hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + /* Check if pointer is not NULL to avoid multiple freeing */ + if( ph && * ph ) + { + /* Destroy the object */ + fclose( ( FILE * ) * ph ); + + /* set pointer to NULL to avoid multiple freeing */ + * ph = NULL; + } #endif } diff --git a/harbour/contrib/hbpgsql/tests/test.prg b/harbour/contrib/hbpgsql/tests/test.prg index ca3b59be96..c5a65e4d44 100644 --- a/harbour/contrib/hbpgsql/tests/test.prg +++ b/harbour/contrib/hbpgsql/tests/test.prg @@ -94,6 +94,6 @@ Function main() res := NIL PQuntrace( conn ) - PQclosetrace( pFile ) + pFile := NIL conn := NIL return NIL