2009-12-07 16:30 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbide/hbide.prg
    + Added some more debug code.
      Now HBIDE exits cleanly.

  * contrib/hbqt/hbqt_destruct.cpp
    - Removed HBQT_QTPTR_FROM_GCPOINTER()
    + Added   ISEQUALGCQTPOINTER()

  * contrib/hbqt/hbqt_slots.cpp
    ! Fixed MainWindow::~MainWindow() calls. Was a reason FOR many GPFs.

  * contrib/hbqt/qtgui/QApplication.cpp
  * contrib/hbqt/qth/QApplication.qth
    - Removed call to Qt_destroy_codeblocks().

  * contrib/hbxbp/xbpfontdialog.prg
    ! Proper destruction of font and font metrix.
  * contrib/hbxbp/xbptabpage.prg
    % Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
  * contrib/hbxbp/xbptreeview.prg
    % Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
  * contrib/hbxbp/xbpwindow.prg
    % Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
  * contrib/hbxbp/tests/demoxbp.prg
    ! Test calls to overview memory usage with different modes to release Qt pointers.
      Now it exits cleanly.
  * contrib/hbide/hbide.prg
    + Added some more debug code.
      Now HBIDE exits cleanly.

  * contrib/hbqt/hbqt_destruct.cpp
    - Removed HBQT_QTPTR_FROM_GCPOINTER()
    + Added   ISEQUALGCQTPOINTER()

  * contrib/hbqt/hbqt_slots.cpp
    ! Matched  hb_vmRequestReenter() / hb_vmRequestRestore() calls.
    ! Fixed MainWindow::~MainWindow() calls. Was a reason FOR many GPFs.

  * contrib/hbqt/qtgui/QApplication.cpp
  * contrib/hbqt/qth/QApplication.qth
    - Removed call to Qt_destroy_codeblocks().

  * contrib/hbxbp/xbpfontdialog.prg
    ! Proper destruction of font and font metrix.
  * contrib/hbxbp/xbptabpage.prg
    % Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
  * contrib/hbxbp/xbptreeview.prg
    % Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
  * contrib/hbxbp/xbpwindow.prg
    % Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
  * contrib/hbxbp/tests/demoxbp.prg
    ! Test calls to overview memory usage with different modes to release Qt pointers.
      Now it exits cleanly.
This commit is contained in:
Pritpal Bedi
2009-12-08 00:31:10 +00:00
parent 224afe83e1
commit 9cdf566db1
11 changed files with 101 additions and 97 deletions

View File

@@ -17,6 +17,61 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-07 16:30 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/hbide.prg
+ Added some more debug code.
Now HBIDE exits cleanly.
* contrib/hbqt/hbqt_destruct.cpp
- Removed HBQT_QTPTR_FROM_GCPOINTER()
+ Added ISEQUALGCQTPOINTER()
* contrib/hbqt/hbqt_slots.cpp
! Fixed MainWindow::~MainWindow() calls. Was a reason FOR many GPFs.
* contrib/hbqt/qtgui/QApplication.cpp
* contrib/hbqt/qth/QApplication.qth
- Removed call to Qt_destroy_codeblocks().
* contrib/hbxbp/xbpfontdialog.prg
! Proper destruction of font and font metrix.
* contrib/hbxbp/xbptabpage.prg
% Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
* contrib/hbxbp/xbptreeview.prg
% Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
* contrib/hbxbp/xbpwindow.prg
% Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
* contrib/hbxbp/tests/demoxbp.prg
! Test calls to overview memory usage with different modes to release Qt pointers.
Now it exits cleanly.
* contrib/hbide/hbide.prg
+ Added some more debug code.
Now HBIDE exits cleanly.
* contrib/hbqt/hbqt_destruct.cpp
- Removed HBQT_QTPTR_FROM_GCPOINTER()
+ Added ISEQUALGCQTPOINTER()
* contrib/hbqt/hbqt_slots.cpp
! Matched hb_vmRequestReenter() / hb_vmRequestRestore() calls.
! Fixed MainWindow::~MainWindow() calls. Was a reason FOR many GPFs.
* contrib/hbqt/qtgui/QApplication.cpp
* contrib/hbqt/qth/QApplication.qth
- Removed call to Qt_destroy_codeblocks().
* contrib/hbxbp/xbpfontdialog.prg
! Proper destruction of font and font metrix.
* contrib/hbxbp/xbptabpage.prg
% Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
* contrib/hbxbp/xbptreeview.prg
% Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
* contrib/hbxbp/xbpwindow.prg
% Replaced call to HBQT_QTPTR_FROM_GCPOINTER() => IsEqualGcQtPointer()
* contrib/hbxbp/tests/demoxbp.prg
! Test calls to overview memory usage with different modes to release Qt pointers.
Now it exits cleanly.
2009-12-08 01:09 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
+ contrib/hbqt/hbqt_hbqtsyntaxhighlighter.cpp
+ contrib/hbqt/hbqt_hbqtdbfmodel.cpp
@@ -39,6 +94,7 @@
* contrib/rddads/ads1.c
* Minor formatting.
>>>>>>> .r13156
2009-12-07 19:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/config/global.mk
! fixed variable name in output message

View File

@@ -86,6 +86,10 @@ STATIC s_pathSep
PROCEDURE Main( cProjIni )
LOCAL oIde
HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DESTRUTOR ) // Exits cleanly
//HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DELETE ) // Exits cleanly
//HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DELETE_LATER ) // Exits cleanly
s_resPath := hb_DirBase() + "resources" + hb_OsPathSeparator()
s_pathSep := hb_OsPathSeparator()
@@ -255,7 +259,6 @@ METHOD HbIde:new( cProjIni )
/*----------------------------------------------------------------------*/
METHOD HbIde:create( cProjIni )
// LOCAL qWidget
::loadConfig( cProjIni )
@@ -274,36 +277,6 @@ METHOD HbIde:create( cProjIni )
::buildFuncList()
::buildBottomArea()
#if 0
::qLeftLayout := QGridLayout():new()
::qLeftLayout:setContentsMargins( 0,0,0,0 )
::qLeftLayout:setHorizontalSpacing( 0 )
::qLeftLayout:setVerticalSpacing( 0 )
::qMidLayout := QGridLayout():new()
::qMidLayout:setContentsMargins( 0,0,0,0 )
::qMidLayout:setHorizontalSpacing( 0 )
::qMidLayout:setVerticalSpacing( 0 )
::qLeftArea := QWidget():new()
::qLeftArea:setLayout( QT_PTROF( ::qLeftLayout ) )
// qWidget:oWidget:setLayout( QT_PTROF( ::qLeftLayout ) )
::qMidArea := QWidget():new()
::qMidArea:setLayout( QT_PTROF( ::qMidLayout ) )
::qLeftLayout:addWidget_1( QT_PTROFXBP( ::oProjTree ), 0, 0, 1, 1 )
::qLeftLayout:addWidget_1( QT_PTROFXBP( qWidget ), 1, 0, 1, 1 )
::qMidLayout:addWidget_1( QT_PTROFXBP( ::oDa:oTabWidget ), 0, 0, 1, 1 )
::qSplitter := QSplitter():new( QT_PTROF( ::oDa:oWidget ) )
::qSplitter:addWidget( QT_PTROF( ::qLeftArea ) )
::qSplitter:addWidget( QT_PTROF( ::qMidArea ) )
::qSplitter:show()
#else
::qLayout := QGridLayout():new()
::qLayout:setContentsMargins( 0,0,0,0 )
::qLayout:setHorizontalSpacing( 0 )
@@ -319,7 +292,6 @@ METHOD HbIde:create( cProjIni )
::qSplitter:addWidget( QT_PTROFXBP( ::oDa:oTabWidget ) )
::qSplitter:show()
#endif
::qCursor := QTextCursor():new()
@@ -381,13 +353,22 @@ METHOD HbIde:create( cProjIni )
::oXbp:handleEvent( ::nEvent, ::mp1, ::mp2 )
ENDDO
HBXBP_DEBUG( "EXITING.................." )
/* Very important - destroy resources */
HBXBP_DEBUG( "Before", "::oDlg:destroy()" )
::oDlg:destroy()
HBXBP_DEBUG( "After", "::oDlg:destroy()" )
::qCursor:pPtr := 0
::oFont := NIL
HBXBP_DEBUG( "EXITING after destroy .................." )
/* A NOTE:
::qSplitter and ::qLayout are released automatically
when ~MainWindow() is called and GC engine reports it as relaesed.
This is a good testimony that all the memory is recaptured properly.
*/
RETURN self
/*----------------------------------------------------------------------*/
@@ -419,7 +400,8 @@ METHOD HbIde:saveConfig()
aadd( txt_, "[FILES]" )
FOR n := 1 TO nTabs
pTab := ::qTabWidget:widget( n-1 )
nTab := ascan( ::aTabs, {|e_| HBQT_QTPTR_FROM_GCPOINTER( QT_PTROFXBP( e_[ 1 ] ) ) == pTab } )
//nTab := ascan( ::aTabs, {|e_| HBQT_QTPTR_FROM_GCPOINTER( QT_PTROFXBP( e_[ 1 ] ) ) == pTab } )
nTab := ascan( ::aTabs, {|e_| IsEqualGcQtPointer( QT_PTROFXBP( e_[ 1 ] ), pTab ) } )
qEdit := ::aTabs[ nTab, 2 ]
qHScr := QScrollBar():configure( qEdit:horizontalScrollBar() )
qVScr := QScrollBar():configure( qEdit:verticalScrollBar() )
@@ -870,7 +852,7 @@ METHOD HbIde:getCurrentTab()
LOCAL qTab, nTab
qTab := ::qTabWidget:currentWidget()
nTab := ascan( ::aTabs, {|e_| HBQT_QTPTR_FROM_GCPOINTER( e_[ 1 ]:oWidget:pPtr ) == qTab } )
nTab := ascan( ::aTabs, {|e_| IsEqualGcQtPointer( e_[ 1 ]:oWidget:pPtr, qTab ) } )
RETURN nTab
@@ -1702,16 +1684,16 @@ METHOD HbIde:fetchProjectProperties()
qPrpDlg:exec()
Qt_DisConnect_Signal( QT_PTROF( oTabWidget ), "currentChanged(int)" )
oPBOk:destroy()
oPBSv:destroy()
oPBCn:destroy()
oPBSelect:destroy()
Qt_DisConnect_Signal( QT_PTROF( oTabWidget ), "currentChanged(int)" )
::aPrpObjs := {}
ENDIF
::aPrpObjs := {}
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -115,13 +115,17 @@ HB_FUNC( HBQT_SET_RELEASE_METHOD )
s_iObjectReleaseMethod = hb_parni( 1 );
}
HB_FUNC( HBQT_QTPTR_FROM_GCPOINTER )
HB_FUNC( ISEQUALGCQTPOINTER )
{
QGC_POINTER * p = ( QGC_POINTER * ) hb_parptrGC( gcFuncs(), 1 );
if( p && p->ph )
{
hb_retptr( p->ph );
hb_retl( p->ph == hb_parptr( 2 ) );
}
else
{
hb_retl( false );
}
}

View File

@@ -1120,50 +1120,8 @@ HB_FUNC( QT_SLOTS_DESTROY )
qt_getEventSlots()->~Slots();
}
/*
* harbour function to release all codeblocks stored
*/
HB_FUNC( RELEASE_CODEBLOCKS )
{
Slots * s_s = qt_getEventSlots();
if( s_s )
{
for( int i = 0; i < s_s->listBlock.size(); ++i )
{
if( s_s->listBlock.at( i ) )
{
hb_itemRelease( s_s->listBlock.at( i ) );
s_s->listBlock[ i ] = NULL;
}
}
}
}
/*
* C function to release all codeblocks storeds
* called at end of the program
* see qapplication.cpp
*/
void release_codeblocks( void )
{
Slots * s_s = qt_getEventSlots();
if( s_s )
{
for( int i = 0; i < s_s->listBlock.size(); ++i )
{
if( s_s->listBlock.at( i ) )
{
hb_itemRelease( s_s->listBlock.at( i ) );
s_s->listBlock[ i ] = NULL;
}
}
}
}
/*----------------------------------------------------------------------*/
Events::Events( QObject * parent ) : QObject( parent )
{
}
@@ -1313,7 +1271,6 @@ MyMainWindow::~MyMainWindow( void )
hbqt_debug( " MyMainWindow::~MyMainWindow 0" );
#endif
hb_itemRelease( block );
destroy();
#if defined( __HB_DEBUG__ )
hbqt_debug( " MyMainWindow::~MyMainWindow 1" );
#endif

View File

@@ -113,7 +113,7 @@ static void hbqt_Exit( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
release_codeblocks();
//release_codeblocks();
}
static void hbqt_Init( void * cargo )

View File

@@ -104,7 +104,7 @@ static void hbqt_Exit( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
release_codeblocks();
//release_codeblocks();
}
static void hbqt_Init( void * cargo )

View File

@@ -92,6 +92,10 @@ STATIC oMLE
PROCEDURE Main()
HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DESTRUTOR ) // Exits cleanly
//HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DELETE ) // Exits cleanly
//HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DELETE_LATER ) // Exit with GPF
//hb_threadStart( {|| _BuildADialog() } )
_BuildADialog()

View File

@@ -460,6 +460,9 @@ METHOD XbpFont:configure()
METHOD XbpFont:destroy()
::oFontInfo:pPtr := 0
::oWidget:pPtr := 0
RETURN NIL
/*----------------------------------------------------------------------*/

View File

@@ -295,7 +295,7 @@ METHOD XbpTabWidget:exeBlock( nMode, iIndex )
IF !empty( ::aChildren ) .and. iIndex >= 0 .and. iIndex < len( ::aChildren )
qTab := ::oWidget:widget( iIndex )
IF ( nIndex := ascan( ::aChildren, {|o| HBQT_QTPTR_FROM_GCPOINTER( o:oWidget:pPtr ) == qTab } ) ) > 0
IF ( nIndex := ascan( ::aChildren, {|o| IsEqualGcQtPointer( o:oWidget:pPtr, qTab ) } ) ) > 0
oTab := ::aChildren[ nIndex ]
DO CASE

View File

@@ -199,7 +199,7 @@ METHOD XbpTreeView:ExeBlock( nMsg, p1, p2 )
HB_SYMBOL_UNUSED( p2 )
IF hb_isPointer( p1 )
IF ( n := ascan( ::aItems, {|o| o:qPointer == p1 } ) ) > 0
IF ( n := ascan( ::aItems, {|o| IsEqualGcQtPointer( o:oWidget:pPtr, p1 ) } ) ) > 0
oItem := ::aItems[ n ]
ENDIF
ENDIF
@@ -221,7 +221,6 @@ METHOD XbpTreeView:ExeBlock( nMsg, p1, p2 )
eval( ::sl_itemSelected, oItem, {0,0,0,0}, self )
ENDIF
CASE nMsg == 7 // "itemEntered(QTWItem)"
//::oWidget:setToolTip( oItem:caption )
CASE nMsg == 8 // "itemExpanded(QTWItem)"
IF hb_isBlock( ::sl_itemExpanded )
eval( ::sl_itemExpanded, oItem, {0,0,0,0}, self )
@@ -347,7 +346,6 @@ CLASS XbpTreeViewItem INHERIT XbpDataRef
DATA hItem
DATA oParent
DATA oXbpTree
DATA qPointer
DATA aChilds INIT {}
@@ -384,7 +382,6 @@ METHOD XbpTreeViewItem:addItem( xItem, xNormalImage, xMarkedImage, xExpandedImag
oItem:caption := xItem
oItem:oWidget := QTreeWidgetItem():new()
oItem:oWidget:setText( 0, oItem:caption )
oItem:qPointer := HBQT_QTPTR_FROM_GCPOINTER( oItem:oWidget:pPtr )
ELSE
oItem := xItem // aNode
ENDIF
@@ -478,10 +475,11 @@ METHOD XbpTreeViewItem:setMarkedImage( nResIdoBitmap )
METHOD XbpTreeViewItem:delItem( oItem )
LOCAL n
IF ( n := ascan( ::aChilds, {|o| o:caption == oItem:caption } ) ) > 0
IF ( n := ascan( ::aChilds, {|o| o == oItem } ) ) > 0
::oWidget:removeChild( ::aChilds[ n ]:oWidget:pPtr )
::aChilds[ n ]:oWidget:pPtr := 0
adel( ::aChilds, n ) ; asize( ::aChilds, len( ::aChilds )-1 )
adel( ::aChilds, n )
asize( ::aChilds, len( ::aChilds )-1 )
ENDIF
RETURN NIL

View File

@@ -768,11 +768,11 @@ METHOD XbpWindow:destroy()
Qt_Slots_Destroy()
Qt_Events_Destroy()
Qt_MyMainWindow_Destroy( QT_PTROF( ::oWidget ) )
ELSE
::oWidget:pPtr := 0
::oWidget := NIL
ENDIF
::oWidget:pPtr := 0
::oWidget := NIL
//HBXBP_DEBUG( ThreadID()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() )
RETURN NIL