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)
This commit is contained in:
Viktor Szakats
2009-12-08 01:53:53 +00:00
parent 94d36a2228
commit f0be172fe0
6 changed files with 43 additions and 17 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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
/*----------------------------------------------------------------------*/

View File

@@ -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
/*----------------------------------------------------------------------*/

View File

@@ -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

View File

@@ -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