From c5f23b422ea46c7fc95cd8ca2a12386bf0ddb88a Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Mon, 7 May 2012 08:08:58 +0000 Subject: [PATCH] 2012-05-07 01:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtcore/hbqt_pointer.cpp + Added: hbqt_par_isDerivedFrom() - protection against a null pointer passed as an argument. This makes possible to detect if an object is still active when passed. If not, a RTE is generated. This covers some more potential user mistakes. --- harbour/ChangeLog | 7 +++++++ harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1f17a62195..c3af7b8bd9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,13 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-07 01:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtcore/hbqt_pointer.cpp + + Added: hbqt_par_isDerivedFrom() - protection against a null + pointer passed as an argument. This makes possible to detect + if an object is still active when passed. If not, a RTE is + generated. This covers some more potential user mistakes. + 2012-05-07 00:57 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth * contrib/hbqt/qtgui/qth/HBQGraphicsScene.qth diff --git a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp index b6689ed74c..6ad3c974b8 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp @@ -491,7 +491,12 @@ HB_BOOL hbqt_par_isDerivedFrom( int iParam, const char * pszClsName ) HB_TRACE( HB_TR_DEBUG, ( "hbqt_par_isDerivedFrom( %i, %s )", iParam, pszClsName ) ); if( ( pItem = hb_param( iParam, HB_IT_OBJECT ) ) != NULL ) - return hbqt_obj_isDerivedFrom( pItem, pszClsName ); + { + if( s_hbqt_GCPointerFromItem( pItem ) == NULL ) + hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + else + return hbqt_obj_isDerivedFrom( pItem, pszClsName ); + } return HB_FALSE; }