diff --git a/harbour/ChangeLog b/harbour/ChangeLog index cc0d591522..a2792287bb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,19 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-08 02:53 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/hbqt_slots.cpp + ! Fixed to check for NULL pointer and return error in + QT_CONNECT_EVENT() and QT_DISCONNECT_EVENT() and MyMainWindow desctructor. + ; TOFIX: Passing non-block to QT_MYMAINWINDOW() first parameter will cause GPFs. + + * contrib/hbxbp/tests/demoxbp.prg + * contrib/hbxbp/xbpwindow.prg + * contrib/hbxbp/xbpdialog.prg + * contrib/hbxbp/xbpgeneric.prg + ! THREADID() -> HB_THREADID(). + (former is not necessarily available in core) + 2009-12-08 02:41 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/hbqt_slots.cpp % Eliminated local variable in all Slots:: method. diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index bcc78d7b88..7fc75e6a67 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -867,7 +867,7 @@ void Slots::paintRequested( QPrinter * printer ) */ HB_FUNC( QT_CONNECT_SIGNAL ) { - QObject * object = ( QObject * ) hbqt_gcpointer( 1 ); /* get sender */ + QObject * object = ( QObject * ) hbqt_gcpointer( 1 ); /* get sender */ if( object == NULL ) { @@ -1202,10 +1202,17 @@ HB_FUNC( QT_QEVENTFILTER ) HB_FUNC( QT_CONNECT_EVENT ) { + QObject * object = ( QObject* ) hbqt_gcpointer( 1 ); /* get sender */ + + if( object == NULL ) + { + hb_retl( HB_FALSE ); + return; + } + int type = hb_parni( 2 ); PHB_ITEM codeblock = hb_itemNew( hb_param( 3, HB_IT_BLOCK | HB_IT_BYREF ) ); Events * s_e = qt_getEventFilter(); - QObject * object = ( QObject* ) hbqt_gcpointer( 1 ); /* get sender */ char prop[ 20 ]; hb_snprintf( prop, sizeof( prop ), "%s%i%s", "P", type, "P" ); /* Make it a unique identifier */ @@ -1220,10 +1227,17 @@ HB_FUNC( QT_CONNECT_EVENT ) HB_FUNC( QT_DISCONNECT_EVENT ) { + QObject * object = ( QObject* ) hbqt_gcpointer( 1 ); + + if( object == NULL ) + { + hb_retl( HB_FALSE ); + return; + } + int type = hb_parni( 2 ); bool bRet = false; Events * s_e = qt_getEventFilter(); - QObject * object = ( QObject* ) hbqt_gcpointer( 1 ); char prop[ 10 ]; hb_snprintf( prop, sizeof( prop ), "%s%i%s", "P", type, "P" ); /* Make it a unique identifier */ @@ -1268,7 +1282,8 @@ MyMainWindow::~MyMainWindow( void ) #if defined( __HB_DEBUG__ ) hbqt_debug( " MyMainWindow::~MyMainWindow 0" ); #endif - hb_itemRelease( block ); + if( block ) + hb_itemRelease( block ); #if defined( __HB_DEBUG__ ) hbqt_debug( " MyMainWindow::~MyMainWindow 1" ); #endif diff --git a/harbour/contrib/hbxbp/tests/demoxbp.prg b/harbour/contrib/hbxbp/tests/demoxbp.prg index 297b86135e..6a16c5a70c 100644 --- a/harbour/contrib/hbxbp/tests/demoxbp.prg +++ b/harbour/contrib/hbxbp/tests/demoxbp.prg @@ -115,7 +115,7 @@ FUNCTION _BuildADialog() PROCEDURE DispMem( cMessage ) HB_SYMBOL_UNUSED( cMessage ) - HBXBP_DEBUG( ThreadID(), padc( cMessage, 40 ), memory( 1001 ), hbqt_getMemUsed() ) + HBXBP_DEBUG( hb_threadId(), padc( cMessage, 40 ), memory( 1001 ), hbqt_getMemUsed() ) RETURN @@ -123,7 +123,7 @@ PROCEDURE DispMem( cMessage ) PROCEDURE BuildADialog() LOCAL oDlg, mp1, mp2, oXbp, nEvent, aSize, oDa, aTabs, oHTM - LOCAL nThread := ThreadID() + LOCAL nThread := hb_threadId() //LOCAL oStat, aMenu, aTool, aBrow, aChek, a3Sta HBXBP_DEBUG( " . " ) @@ -1985,4 +1985,3 @@ STATIC FUNCTION TBPrev() RETURN lMoved /*----------------------------------------------------------------------*/ - diff --git a/harbour/contrib/hbxbp/xbpdialog.prg b/harbour/contrib/hbxbp/xbpdialog.prg index bb9982067d..2ca5093c0f 100644 --- a/harbour/contrib/hbxbp/xbpdialog.prg +++ b/harbour/contrib/hbxbp/xbpdialog.prg @@ -120,13 +120,13 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - ::cargo := ThreadID() /* To Be Removed */ + ::cargo := hb_threadId() /* To Be Removed */ #ifdef __QMAINWINDOW__ ::oWidget := QMainWindow():new() //::oWidget:setMouseTracking( .t. ) #else - ::oWidget := QMainWindow():configure( QT_MyMainWindow( {|n,p| ::grabEvent( n,p ) }, ThreadID() ) ) + ::oWidget := QMainWindow():configure( QT_MyMainWindow( {|n,p| ::grabEvent( n,p ) }, hb_threadId() ) ) #endif IF !empty( ::title ) @@ -306,4 +306,3 @@ METHOD XbpDrawingArea:create( oParent, oOwner, aPos, aSize, aPresParams, lVisibl RETURN Self /*----------------------------------------------------------------------*/ - diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index 68f2d3b46f..1b04eb1ef7 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -182,21 +182,21 @@ FUNCTION SetAppEvent( nEvent, mp1, mp2, oXbp ) t_nEventIn := 1 ENDIF -//HBXBP_DEBUG( 0, "SetAppEvent ... ", threadID(), nEvent, xbeP_Paint ) +//HBXBP_DEBUG( 0, "SetAppEvent ... ", hb_threadId(), nEvent, xbeP_Paint ) t_events[ t_nEventIn, 1 ] := nEvent t_events[ t_nEventIn, 2 ] := mp1 t_events[ t_nEventIn, 3 ] := mp2 t_events[ t_nEventIn, 4 ] := oXbp -//HBXBP_DEBUG( 1, "SetAppEvent ... ", threadID(), nEvent ) +//HBXBP_DEBUG( 1, "SetAppEvent ... ", hb_threadId(), nEvent ) RETURN nil /*----------------------------------------------------------------------*/ FUNCTION AppEvent( mp1, mp2, oXbp, nTimeout ) LOCAL nEvent - //LOCAL nThreadID := ThreadID() + //LOCAL nThreadID := hb_threadId() //DEFAULT nTimeout TO 0 HB_SYMBOL_UNUSED( nTimeOut ) @@ -218,7 +218,7 @@ FUNCTION AppEvent( mp1, mp2, oXbp, nTimeout ) ENDIF hb_releaseCPU() ENDDO -//HBXBP_DEBUG( "..........................", threadID() ) +//HBXBP_DEBUG( "..........................", hb_threadId() ) RETURN nEvent diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index bd45e26c81..c71dc7c758 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -451,7 +451,7 @@ METHOD XbpWindow:grabEvent( nEvent, pEvent, oXbp ) HB_SYMBOL_UNUSED( oXbp ) -//HBXBP_DEBUG( threadID(), "XbpWindow:grabEvent", nEvent ) +//HBXBP_DEBUG( hb_threadId(), "XbpWindow:grabEvent", nEvent ) SWITCH ( nEvent ) @@ -736,7 +736,7 @@ METHOD XbpWindow:destroy() LOCAL cXbp := __ObjGetClsName( self ) //HBXBP_DEBUG( ". " ) -//HBXBP_DEBUG( ThreadID(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) +//HBXBP_DEBUG( hb_threadId(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) IF cXbp == "XBPDIALOG" SetEventLoop( NIL ) @@ -773,7 +773,7 @@ METHOD XbpWindow:destroy() ::oWidget := NIL ENDIF -//HBXBP_DEBUG( ThreadID()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) +//HBXBP_DEBUG( hb_threadId()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) RETURN NIL