From c98ef20c293bc624da3e71a0fd12532a19bf70ea Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Thu, 24 Mar 2011 19:03:49 +0000 Subject: [PATCH] 2011-03-24 11:57 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hbs ! Code clean-up. ! Restrored: how the obejcet is addressed in methods. NOTE: Do not change. * contrib/hbqt/qtcore/hbqt_misc.prg ! Restored: :disconnect(). ! Connect was generating error it obejct was freed prior to execution. --- harbour/ChangeLog | 10 ++++++++++ harbour/contrib/hbqt/hbmk2_qt.hbs | 23 ++++------------------- harbour/contrib/hbqt/qtcore/hbqt_misc.prg | 11 +++++++---- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 840ad53e7f..f9bab21aab 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,16 @@ The license applies to all entries newer than 2009-04-28. */ +2011-03-24 11:57 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/hbmk2_qt.hbs + ! Code clean-up. + ! Restrored: how the obejcet is addressed in methods. + NOTE: Do not change. + + * contrib/hbqt/qtcore/hbqt_misc.prg + ! Restored: :disconnect(). + ! Connect was generating error it obejct was freed prior to execution. + 2011-03-23 12:27 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/idedocks.prg ! Changed: the way destructors were called. diff --git a/harbour/contrib/hbqt/hbmk2_qt.hbs b/harbour/contrib/hbqt/hbmk2_qt.hbs index 666144f370..a3ef5c80f2 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hbs +++ b/harbour/contrib/hbqt/hbmk2_qt.hbs @@ -1478,7 +1478,6 @@ METHOD HbQtSource:build() aadd( aLine, " }" ) #endif aadd( aLine, " p->ph = NULL;" ) - aadd( aLine, " p = NULL;" ) aadd( aLine, " }" ) #ifdef _GEN_TRACE_ aadd( aLine, " else" ) @@ -1725,7 +1724,7 @@ METHOD HbQtSource:getMethodBody( oMtd, cMtdName, aMethods, nClsType ) // check for methods already worked IF ( ascan( ::func_, {|e_| e_[ 1 ] == oMtd:cFun } ) ) > 0 - return {} + return {} ENDIF oMtd:cHBFunc := oMtd:cFun @@ -1733,12 +1732,12 @@ METHOD HbQtSource:getMethodBody( oMtd, cMtdName, aMethods, nClsType ) aadd( txt_, "/* " + strtran( oMtd:cProto, chr( 13 ) ) + " */" ) - v := "_" + lower( substr( ::cQtObject, 2 ) ) - +// v := "_" + lower( substr( ::cQtObject, 2 ) ) /* This unneccessarily makes it difficlt to compare two sources with similar functions */ + v := "p" aadd( txt_, "HB_FUNC_STATIC( " + upper( oMtd:cHBFunc ) + " )" ) aadd( txt_, "{" ) -// aadd( txt_, ' HB_TRACE( ' + ::cTrMode + ', ( "' + ::cQtObject + ":" + oMtd:cHBFunc + '" ) );' ) +// aadd( txt_, ' HB_TRACE( ' + ::cTrMode + ', ( "' + ::cQtObject + ":" + oMtd:cHBFunc + '" ) );' ) aadd( txt_, ' HB_TRACE( HB_TR_DEBUG, ( "' + ::cQtObject + ":" + oMtd:cHBFunc + '" ) );' ) IF !empty( oMtd:fBody_ ) @@ -1753,17 +1752,6 @@ METHOD HbQtSource:getMethodBody( oMtd, cMtdName, aMethods, nClsType ) ENDIF ENDIF - /* Insert parameters by reference */ -//REMMED IF ! empty( oMtd:aPre ) -//REMMED FOR n := 1 TO len( oMtd:aPre ) -//REMMED aadd( txt_, " " + oMtd:aPre[ n, 1 ] ) -//REMMED NEXT -//REMMED aadd( txt_, "" ) -//REMMED ENDIF - - /* One line function body */ -// FP: to check, modificare come sopra - IF len( a_ ) == 1 .AND. a_[ 1 ]:nArgs == 0 IF ! oMtd:isConstructor FP := ::normalizeCmd( a_[ 1 ], v ) @@ -1912,15 +1900,12 @@ STATIC FUNCTION hbide_paramCheckStrCpp( cType, nArg, cCast ) SWITCH cType CASE "PB" - // RETURN "( " + "hb_isBlock( hb_pvalue( " + hb_ntos( nArg ) + " ) )" + " .OR. " + "hb_isPointer( hb_pvalue( " + hb_ntos( nArg ) + " ) ) )" RETURN "! HB_ISNIL( " + hb_ntos( nArg ) + " )" CASE "P" //TODO RETURN "HB_ISPOINTER( " + hb_ntos( nArg ) + " )" CASE "O" - // RETURN "hbqt_isObjectType( " + hb_ntos( nArg ) + ", HBQT_TYPE_" + cCast + " )" RETURN "HB_ISOBJECT( " + hb_ntos( nArg ) + " )" CASE "CO" - // RETURN "( hbqt_isObjectType( " + hb_ntos( nArg ) + " , HBQT_TYPE_" + cCast + " ) || HB_ISCHAR( " + hb_ntos( nArg ) + " ) )" RETURN "( HB_ISOBJECT( " + hb_ntos( nArg ) + " ) || HB_ISCHAR( " + hb_ntos( nArg ) + " ) )" CASE "N*" RETURN "HB_ISBYREF( " + hb_ntos( nArg ) + " )" diff --git a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg index 0a831ba3ee..f435e6d9ee 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg +++ b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg @@ -136,6 +136,10 @@ STATIC FUNCTION HBQEventsFromPointer( ... ) METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) LOCAL nResult + IF ! hb_isBlock( bBlock ) + RETURN .f. + ENDIF + SWITCH ValType( cnEvent ) CASE "C" @@ -163,7 +167,7 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) SWITCH nResult CASE 0 RETURN .T. - CASE -3 /* event already connected */ + CASE -3 /* bBlock not supplied */ RETURN .F. ENDSWITCH EXIT @@ -179,7 +183,7 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) /*----------------------------------------------------------------------*/ METHOD HbQtObjectHandler:disconnect( cnEvent ) - #if 0 + LOCAL nResult SWITCH ValType( cnEvent ) CASE "C" @@ -192,6 +196,7 @@ METHOD HbQtObjectHandler:disconnect( cnEvent ) CASE 5 /* disconnect failure */ RETURN .T. CASE 1 /* wrong slot container, no connect was called yet */ + CASE 2 /* object has been already freed */ CASE 3 /* event not found */ RETURN .F. ENDSWITCH @@ -215,8 +220,6 @@ METHOD HbQtObjectHandler:disconnect( cnEvent ) __hbqt_error( 1300 + nResult ) RETURN .F. - #endif - RETURN cnEvent /*----------------------------------------------------------------------*/