diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 05b54c7f75..9372d5f6fd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,302 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-13 17:43 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + + * contrib/hbqt/generator/hbqtgen.prg + * contrib/hbqt/qth/QAbstractItemModel.qth + + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_destruct.cpp + * contrib/hbqt/hbqt_garbage.h + * contrib/hbqt/hbqt_slots.cpp + + * contrib/hbqt/qtcore/QAbstractItemModel.cpp + * contrib/hbqt/qtcore/QAbstractListModel.cpp + * contrib/hbqt/qtcore/QAbstractTableModel.cpp + * contrib/hbqt/qtcore/QBitArray.cpp + * contrib/hbqt/qtcore/QByteArray.cpp + * contrib/hbqt/qtcore/QCoreApplication.cpp + * contrib/hbqt/qtcore/QDataStream.cpp + * contrib/hbqt/qtcore/QDate.cpp + * contrib/hbqt/qtcore/QDateTime.cpp + * contrib/hbqt/qtcore/QDir.cpp + * contrib/hbqt/qtcore/QEvent.cpp + * contrib/hbqt/qtcore/QEventLoop.cpp + * contrib/hbqt/qtcore/QFile.cpp + * contrib/hbqt/qtcore/QFileInfo.cpp + * contrib/hbqt/qtcore/QIODevice.cpp + * contrib/hbqt/qtcore/QLatin1Char.cpp + * contrib/hbqt/qtcore/QLatin1String.cpp + * contrib/hbqt/qtcore/QLine.cpp + * contrib/hbqt/qtcore/QLineF.cpp + * contrib/hbqt/qtcore/QList.cpp + * contrib/hbqt/qtcore/QLocale.cpp + * contrib/hbqt/qtcore/QMimeData.cpp + * contrib/hbqt/qtcore/QModelIndex.cpp + * contrib/hbqt/qtcore/QObject.cpp + * contrib/hbqt/qtcore/QPoint.cpp + * contrib/hbqt/qtcore/QPointF.cpp + * contrib/hbqt/qtcore/QProcess.cpp + * contrib/hbqt/qtcore/QRect.cpp + * contrib/hbqt/qtcore/QRectF.cpp + * contrib/hbqt/qtcore/QRegExp.cpp + * contrib/hbqt/qtcore/QResource.cpp + * contrib/hbqt/qtcore/QSignalMapper.cpp + * contrib/hbqt/qtcore/QSize.cpp + * contrib/hbqt/qtcore/QSizeF.cpp + * contrib/hbqt/qtcore/QStringList.cpp + * contrib/hbqt/qtcore/QTextBoundaryFinder.cpp + * contrib/hbqt/qtcore/QTextCodec.cpp + * contrib/hbqt/qtcore/QTextDecoder.cpp + * contrib/hbqt/qtcore/QTextEncoder.cpp + * contrib/hbqt/qtcore/QTextStream.cpp + * contrib/hbqt/qtcore/QThread.cpp + * contrib/hbqt/qtcore/QTime.cpp + * contrib/hbqt/qtcore/QTimer.cpp + * contrib/hbqt/qtcore/QTranslator.cpp + * contrib/hbqt/qtcore/QUrl.cpp + * contrib/hbqt/qtcore/QVariant.cpp + + * contrib/hbqt/qtgui/QAbstractButton.cpp + * contrib/hbqt/qtgui/QAbstractItemDelegate.cpp + * contrib/hbqt/qtgui/QAbstractItemView.cpp + * contrib/hbqt/qtgui/QAbstractPrintDialog.cpp + * contrib/hbqt/qtgui/QAbstractProxyModel.cpp + * contrib/hbqt/qtgui/QAbstractScrollArea.cpp + * contrib/hbqt/qtgui/QAbstractSlider.cpp + * contrib/hbqt/qtgui/QAbstractSpinBox.cpp + * contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp + * contrib/hbqt/qtgui/QAction.cpp + * contrib/hbqt/qtgui/QActionGroup.cpp + * contrib/hbqt/qtgui/QApplication.cpp + * contrib/hbqt/qtgui/QBitmap.cpp + * contrib/hbqt/qtgui/QBoxLayout.cpp + * contrib/hbqt/qtgui/QBrush.cpp + * contrib/hbqt/qtgui/QButtonGroup.cpp + * contrib/hbqt/qtgui/QCalendarWidget.cpp + * contrib/hbqt/qtgui/QCheckBox.cpp + * contrib/hbqt/qtgui/QClipboard.cpp + * contrib/hbqt/qtgui/QColor.cpp + * contrib/hbqt/qtgui/QColorDialog.cpp + * contrib/hbqt/qtgui/QComboBox.cpp + * contrib/hbqt/qtgui/QCommandLinkButton.cpp + * contrib/hbqt/qtgui/QCommonStyle.cpp + * contrib/hbqt/qtgui/QCompleter.cpp + * contrib/hbqt/qtgui/QConicalGradient.cpp + * contrib/hbqt/qtgui/QContextMenuEvent.cpp + * contrib/hbqt/qtgui/QCursor.cpp + * contrib/hbqt/qtgui/QDateEdit.cpp + * contrib/hbqt/qtgui/QDateTimeEdit.cpp + * contrib/hbqt/qtgui/QDesktopWidget.cpp + * contrib/hbqt/qtgui/QDial.cpp + * contrib/hbqt/qtgui/QDialog.cpp + * contrib/hbqt/qtgui/QDirModel.cpp + * contrib/hbqt/qtgui/QDockWidget.cpp + * contrib/hbqt/qtgui/QDoubleSpinBox.cpp + * contrib/hbqt/qtgui/QDragEnterEvent.cpp + * contrib/hbqt/qtgui/QDragLeaveEvent.cpp + * contrib/hbqt/qtgui/QDragMoveEvent.cpp + * contrib/hbqt/qtgui/QDropEvent.cpp + * contrib/hbqt/qtgui/QErrorMessage.cpp + * contrib/hbqt/qtgui/QFileDialog.cpp + * contrib/hbqt/qtgui/QFileIconProvider.cpp + * contrib/hbqt/qtgui/QFileSystemModel.cpp + * contrib/hbqt/qtgui/QFocusEvent.cpp + * contrib/hbqt/qtgui/QFocusFrame.cpp + * contrib/hbqt/qtgui/QFont.cpp + * contrib/hbqt/qtgui/QFontComboBox.cpp + * contrib/hbqt/qtgui/QFontDatabase.cpp + * contrib/hbqt/qtgui/QFontDialog.cpp + * contrib/hbqt/qtgui/QFontInfo.cpp + * contrib/hbqt/qtgui/QFontMetrics.cpp + * contrib/hbqt/qtgui/QFontMetricsF.cpp + * contrib/hbqt/qtgui/QFormLayout.cpp + * contrib/hbqt/qtgui/QFrame.cpp + * contrib/hbqt/qtgui/QGradient.cpp + * contrib/hbqt/qtgui/QGridLayout.cpp + * contrib/hbqt/qtgui/QGroupBox.cpp + * contrib/hbqt/qtgui/QHBoxLayout.cpp + * contrib/hbqt/qtgui/QHeaderView.cpp + * contrib/hbqt/qtgui/QHelpEvent.cpp + * contrib/hbqt/qtgui/QIcon.cpp + * contrib/hbqt/qtgui/QImage.cpp + * contrib/hbqt/qtgui/QImageReader.cpp + * contrib/hbqt/qtgui/QImageWriter.cpp + * contrib/hbqt/qtgui/QInputContext.cpp + * contrib/hbqt/qtgui/QInputDialog.cpp + * contrib/hbqt/qtgui/QInputEvent.cpp + * contrib/hbqt/qtgui/QInputMethodEvent.cpp + * contrib/hbqt/qtgui/QItemSelection.cpp + * contrib/hbqt/qtgui/QItemSelectionModel.cpp + * contrib/hbqt/qtgui/QKeyEvent.cpp + * contrib/hbqt/qtgui/QKeySequence.cpp + * contrib/hbqt/qtgui/QLabel.cpp + * contrib/hbqt/qtgui/QLayout.cpp + * contrib/hbqt/qtgui/QLayoutItem.cpp + * contrib/hbqt/qtgui/QLCDNumber.cpp + * contrib/hbqt/qtgui/QLinearGradient.cpp + * contrib/hbqt/qtgui/QLineEdit.cpp + * contrib/hbqt/qtgui/QListView.cpp + * contrib/hbqt/qtgui/QListWidget.cpp + * contrib/hbqt/qtgui/QListWidgetItem.cpp + * contrib/hbqt/qtgui/QMainWindow.cpp + * contrib/hbqt/qtgui/QMatrix.cpp + * contrib/hbqt/qtgui/QMenu.cpp + * contrib/hbqt/qtgui/QMenuBar.cpp + * contrib/hbqt/qtgui/QMessageBox.cpp + * contrib/hbqt/qtgui/QMouseEvent.cpp + * contrib/hbqt/qtgui/QMoveEvent.cpp + * contrib/hbqt/qtgui/QMovie.cpp + * contrib/hbqt/qtgui/QPageSetupDialog.cpp + * contrib/hbqt/qtgui/QPaintDevice.cpp + * contrib/hbqt/qtgui/QPainter.cpp + * contrib/hbqt/qtgui/QPainterPath.cpp + * contrib/hbqt/qtgui/QPaintEvent.cpp + * contrib/hbqt/qtgui/QPalette.cpp + * contrib/hbqt/qtgui/QPen.cpp + * contrib/hbqt/qtgui/QPicture.cpp + * contrib/hbqt/qtgui/QPixmap.cpp + * contrib/hbqt/qtgui/QPolygon.cpp + * contrib/hbqt/qtgui/QPolygonF.cpp + * contrib/hbqt/qtgui/QPrintDialog.cpp + * contrib/hbqt/qtgui/QPrintEngine.cpp + * contrib/hbqt/qtgui/QPrinter.cpp + * contrib/hbqt/qtgui/QPrintPreviewDialog.cpp + * contrib/hbqt/qtgui/QProgressBar.cpp + * contrib/hbqt/qtgui/QProgressDialog.cpp + * contrib/hbqt/qtgui/QPushButton.cpp + * contrib/hbqt/qtgui/QRadialGradient.cpp + * contrib/hbqt/qtgui/QRadioButton.cpp + * contrib/hbqt/qtgui/QRegion.cpp + * contrib/hbqt/qtgui/QResizeEvent.cpp + * contrib/hbqt/qtgui/QScrollArea.cpp + * contrib/hbqt/qtgui/QScrollBar.cpp + * contrib/hbqt/qtgui/QSessionManager.cpp + * contrib/hbqt/qtgui/QSizeGrip.cpp + * contrib/hbqt/qtgui/QSizePolicy.cpp + * contrib/hbqt/qtgui/QSlider.cpp + * contrib/hbqt/qtgui/QSound.cpp + * contrib/hbqt/qtgui/QSpacerItem.cpp + * contrib/hbqt/qtgui/QSpinBox.cpp + * contrib/hbqt/qtgui/QSplashScreen.cpp + * contrib/hbqt/qtgui/QSplitter.cpp + * contrib/hbqt/qtgui/QStandardItem.cpp + * contrib/hbqt/qtgui/QStandardItemModel.cpp + * contrib/hbqt/qtgui/QStatusBar.cpp + * contrib/hbqt/qtgui/QStringListModel.cpp + * contrib/hbqt/qtgui/QStyle.cpp + * contrib/hbqt/qtgui/QStyledItemDelegate.cpp + * contrib/hbqt/qtgui/QStyleFactory.cpp + * contrib/hbqt/qtgui/QStyleHintReturn.cpp + * contrib/hbqt/qtgui/QStyleHintReturnMask.cpp + * contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp + * contrib/hbqt/qtgui/QStyleOption.cpp + * contrib/hbqt/qtgui/QStyleOptionButton.cpp + * contrib/hbqt/qtgui/QStyleOptionComboBox.cpp + * contrib/hbqt/qtgui/QStyleOptionComplex.cpp + * contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp + * contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp + * contrib/hbqt/qtgui/QStyleOptionFrame.cpp + * contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp + * contrib/hbqt/qtgui/QStyleOptionHeader.cpp + * contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp + * contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp + * contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp + * contrib/hbqt/qtgui/QStyleOptionSlider.cpp + * contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp + * contrib/hbqt/qtgui/QStyleOptionTab.cpp + * contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp + * contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp + * contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp + * contrib/hbqt/qtgui/QStyleOptionToolBar.cpp + * contrib/hbqt/qtgui/QStyleOptionToolBox.cpp + * contrib/hbqt/qtgui/QStyleOptionToolButton.cpp + * contrib/hbqt/qtgui/QStyleOptionViewItem.cpp + * contrib/hbqt/qtgui/QStylePainter.cpp + * contrib/hbqt/qtgui/QSystemTrayIcon.cpp + * contrib/hbqt/qtgui/QTabBar.cpp + * contrib/hbqt/qtgui/QTableView.cpp + * contrib/hbqt/qtgui/QTableWidget.cpp + * contrib/hbqt/qtgui/QTableWidgetItem.cpp + * contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp + * contrib/hbqt/qtgui/QTabWidget.cpp + * contrib/hbqt/qtgui/QTextBlock.cpp + * contrib/hbqt/qtgui/QTextBlockFormat.cpp + * contrib/hbqt/qtgui/QTextBrowser.cpp + * contrib/hbqt/qtgui/QTextCharFormat.cpp + * contrib/hbqt/qtgui/QTextCursor.cpp + * contrib/hbqt/qtgui/QTextDocument.cpp + * contrib/hbqt/qtgui/QTextDocumentFragment.cpp + * contrib/hbqt/qtgui/QTextDocumentWriter.cpp + * contrib/hbqt/qtgui/QTextEdit.cpp + * contrib/hbqt/qtgui/QTextFormat.cpp + * contrib/hbqt/qtgui/QTextFragment.cpp + * contrib/hbqt/qtgui/QTextFrame.cpp + * contrib/hbqt/qtgui/QTextFrameFormat.cpp + * contrib/hbqt/qtgui/QTextImageFormat.cpp + * contrib/hbqt/qtgui/QTextInlineObject.cpp + * contrib/hbqt/qtgui/QTextItem.cpp + * contrib/hbqt/qtgui/QTextLayout.cpp + * contrib/hbqt/qtgui/QTextLength.cpp + * contrib/hbqt/qtgui/QTextLine.cpp + * contrib/hbqt/qtgui/QTextListFormat.cpp + * contrib/hbqt/qtgui/QTextObject.cpp + * contrib/hbqt/qtgui/QTextOption.cpp + * contrib/hbqt/qtgui/QTextTableFormat.cpp + * contrib/hbqt/qtgui/QTimeEdit.cpp + * contrib/hbqt/qtgui/QToolBar.cpp + * contrib/hbqt/qtgui/QToolBox.cpp + * contrib/hbqt/qtgui/QToolButton.cpp + * contrib/hbqt/qtgui/QTransform.cpp + * contrib/hbqt/qtgui/QTreeView.cpp + * contrib/hbqt/qtgui/QTreeWidget.cpp + * contrib/hbqt/qtgui/QTreeWidgetItem.cpp + * contrib/hbqt/qtgui/QValidator.cpp + * contrib/hbqt/qtgui/QVBoxLayout.cpp + * contrib/hbqt/qtgui/QWheelEvent.cpp + * contrib/hbqt/qtgui/QWidget.cpp + * contrib/hbqt/qtgui/QWidgetAction.cpp + * contrib/hbqt/qtgui/QWidgetItem.cpp + * contrib/hbqt/qtgui/QWindowsStyle.cpp + * contrib/hbqt/qtgui/QWindowsXPStyle.cpp + * contrib/hbqt/qtgui/QWizard.cpp + * contrib/hbqt/qtgui/QWizardPage.cpp + + * contrib/hbqt/qtnetwork/QFtp.cpp + * contrib/hbqt/qtnetwork/QHttp.cpp + * contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp + * contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp + * contrib/hbqt/qtnetwork/QNetworkRequest.cpp + + * contrib/hbqt/qtwebkit/QWebFrame.cpp + * contrib/hbqt/qtwebkit/QWebHistory.cpp + * contrib/hbqt/qtwebkit/QWebHistoryInterface.cpp + * contrib/hbqt/qtwebkit/QWebHistoryItem.cpp + * contrib/hbqt/qtwebkit/QWebHitTestResult.cpp + * contrib/hbqt/qtwebkit/QWebPage.cpp + * contrib/hbqt/qtwebkit/QWebPluginFactory.cpp + * contrib/hbqt/qtwebkit/QWebSecurityOrigin.cpp + * contrib/hbqt/qtwebkit/QWebSettings.cpp + * contrib/hbqt/qtwebkit/QWebView.cpp + + * contrib/hbxbp/xbpbrowse.prg + * contrib/hbxbp/xbpgeneric.prg + * contrib/hbxbp/xbpwindow.prg + + * contrib/hbxbp/tests/demoxbp.prg + + + Implemented Bisz Istvan's patch with few fixes. Big thank you. + This implementation has a better control over pointers and is dynamic. + + - Completely changed windows logging mechanism. Now it is invoked only + when you define #define __debug__ on C and PRG level + + TO WATCH: Please do extensive testing with demoxbp and demoqt. + We are almost done with pointer resolution, if I am not mistaking, + but we further need to look into why system memory does not go down + and keeps on increasing with every invocation of a dialog. + 2009-11-13 20:40 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/rddads/ads1.c * changed ulRetVal to u32RetVal to be the same name in all file @@ -62,7 +358,7 @@ 2009-11-10 11:55 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbxbp/xbpmenubar.prg - ! Fixed diuble freeing of signals. + ! Fixed double freeing of signals. 2009-11-10 19:31 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbcdpreg.h diff --git a/harbour/contrib/hbqt/generator/hbqtgen.prg b/harbour/contrib/hbqt/generator/hbqtgen.prg index 272f6593f8..fa893f64da 100644 --- a/harbour/contrib/hbqt/generator/hbqtgen.prg +++ b/harbour/contrib/hbqt/generator/hbqtgen.prg @@ -16,6 +16,11 @@ STATIC aGui := {} STATIC aNetwork := {} STATIC aWebkit := {} +/* + * Force new GC and Qt interface + */ +STATIC lNewGCtoQT := .T. + /*----------------------------------------------------------------------*/ FUNCTION Main( ... ) @@ -465,47 +470,127 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) lDestructor := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "destructor" .and. lower( e_[ 2 ] ) == "no"} ) == 0 lObject := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "qobject" .and. lower( e_[ 2 ] ) == "no"} ) == 0 - aadd( cpp_, "QT_G_FUNC( release_" + cWidget + " ) " ) - aadd( cpp_, "{ " ) - IF lDestructor - aadd( cpp_, "#if defined(__debug__)" ) - aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + 'release_' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str );' ) - aadd( cpp_, "#endif" ) - aadd( cpp_, " void * ph = ( void * ) Cargo; " ) - aadd( cpp_, " if( ph ) " ) - aadd( cpp_, " { " ) - IF lObject - aadd( cpp_, " const QMetaObject * m = ( ( QObject * ) ph )->metaObject();" ) - aadd( cpp_, ' if( ( QString ) m->className() != ( QString ) "QObject" )' ) - aadd( cpp_, " {" ) - //aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph ); " ) - aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph )->~" + cWidget + "(); " ) - aadd( cpp_, " ph = NULL;" ) - aadd( cpp_, " }" ) - aadd( cpp_, " else" ) - aadd( cpp_, " {" ) - aadd( cpp_, "#if defined(__debug__)" ) - aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + ' Object Name Missing: ' + cWidget + '" ); OutputDebugString( str );' ) - aadd( cpp_, "#endif" ) - aadd( cpp_, " }" ) - ELSE - //aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph ); " ) - aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph )->~" + cWidget + "(); " ) - aadd( cpp_, " ph = NULL;" ) + IF ( lNewGCtoQT ) + lConst := .f. + FOR i := 3 TO len( new_ ) - 1 + IF left( ltrim( new_[ i ] ), 2 ) != "//" + IF "hb_retptr(" $ new_[ i ] + lConst := .t. + EXIT + ENDIF + ENDIF + NEXT + IF ( lDestructor ) .AND. ( lConst ) + IF lObject + aadd( cpp_, "typedef struct" ) + aadd( cpp_, "{" ) + aadd( cpp_, " void * ph;" ) + aadd( cpp_, " QT_G_FUNC_PTR func;" ) + aadd( cpp_, " QPointer< "+ cWidget +" > pq;" ) + aadd( cpp_, "} QGC_POINTER_" + cWidget + ";" ) + aadd( cpp_, " " ) + ENDIF ENDIF - aadd( cpp_, " }" ) - aadd( cpp_, " else" ) - aadd( cpp_, " {" ) - aadd( cpp_, "#if defined(__debug__)" ) - aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + '! ph____' + cWidget + '" ); OutputDebugString( str );' ) - aadd( cpp_, "#endif" ) - aadd( cpp_, " }" ) + aadd( cpp_, "QT_G_FUNC( release_" + cWidget + " )" ) + aadd( cpp_, "{" ) + IF ( lDestructor ) .AND. ( lConst ) + IF lObject + aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) Cargo; " ) + aadd( cpp_, " " ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "release_' + pad( cWidget, 27 ) + ' p=%p", p));') + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "release_' + pad( cWidget, 27 ) + ' ph=%p pq=%p", p->ph, (void *)(p->pq)));') + aadd( cpp_, " " ) + aadd( cpp_, " if( p && p->ph && p->pq ) " ) + aadd( cpp_, " { " ) + aadd( cpp_, " const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject();" ) + aadd( cpp_, ' if( ( QString ) m->className() != ( QString ) "QObject" )' ) + aadd( cpp_, " {" ) + //aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph ); " ) + aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph )->~" + cWidget + "(); " ) + aadd( cpp_, " p->ph = NULL;" ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "release_' + pad( cWidget, 27 ) + ' Object deleted!" ) );') + aadd( cpp_, " #if defined(__debug__)" ) + aadd( cpp_, ' just_debug( "' + ' YES release_' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() );' ) + aadd( cpp_, " #endif" ) + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "release_' + pad( cWidget, 27 ) + ' Object Name Missing!" ) );') + aadd( cpp_, " #if defined(__debug__)" ) + aadd( cpp_, ' just_debug( "' + ' NO release_' + cWidget + '" );' ) + aadd( cpp_, " #endif" ) + aadd( cpp_, " }" ) + ELSE + aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) Cargo; " ) + aadd( cpp_, " " ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "release_' + pad( cWidget, 27 ) + ' p=%p", p ) );' ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "release_' + pad( cWidget, 27 ) + ' ph=%p", p->ph ) );' ) + aadd( cpp_, " " ) + aadd( cpp_, " if( p && p->ph ) " ) + aadd( cpp_, " { " ) + //aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph ); " ) + aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph )->~" + cWidget + "(); " ) + aadd( cpp_, " p->ph = NULL;" ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "release_' + pad( cWidget, 27 ) + ' Object deleted!" ) );') + aadd( cpp_, " #if defined(__debug__)" ) + aadd( cpp_, ' just_debug( "' + ' YES release_' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() );' ) + aadd( cpp_, " #endif" ) + ENDIF + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "release_' + pad( cWidget, 27 ) + ' Object Allready deleted!" ) );' ) + aadd( cpp_, " #if defined(__debug__)" ) + aadd( cpp_, ' just_debug( "' + ' DEL release_' + cWidget + '" );' ) + aadd( cpp_, " #endif" ) + aadd( cpp_, " }" ) + ELSE + aadd( cpp_, " HB_SYMBOL_UNUSED( Cargo );" ) + ENDIF + aadd( cpp_, "} " ) + aadd( cpp_, " " ) ELSE - aadd( cpp_, " HB_SYMBOL_UNUSED( Cargo );" ) + aadd( cpp_, "QT_G_FUNC( release_" + cWidget + " ) " ) + aadd( cpp_, "{ " ) + IF lDestructor + aadd( cpp_, "#if defined(__debug__)" ) + aadd( cpp_, ' just_debug( "' + 'release_' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() );' ) + aadd( cpp_, "#endif" ) + aadd( cpp_, " void * ph = ( void * ) Cargo; " ) + aadd( cpp_, " if( ph ) " ) + aadd( cpp_, " { " ) + IF lObject + aadd( cpp_, " const QMetaObject * m = ( ( QObject * ) ph )->metaObject();" ) + aadd( cpp_, ' if( ( QString ) m->className() != ( QString ) "QObject" )' ) + aadd( cpp_, " {" ) + //aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph ); " ) + aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph )->~" + cWidget + "(); " ) + aadd( cpp_, " ph = NULL;" ) + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, "#if defined(__debug__)" ) + aadd( cpp_, 'just_debug( "' + ' Object Name Missing: ' + cWidget + '" );' ) + aadd( cpp_, "#endif" ) + aadd( cpp_, " }" ) + ELSE + //aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph ); " ) + aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph )->~" + cWidget + "(); " ) + aadd( cpp_, " ph = NULL;" ) + ENDIF + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, "#if defined(__debug__)" ) + aadd( cpp_, 'just_debug( "' + '! ph____' + cWidget + '" );' ) + aadd( cpp_, "#endif" ) + aadd( cpp_, " }" ) + ELSE + aadd( cpp_, " HB_SYMBOL_UNUSED( Cargo );" ) + ENDIF + aadd( cpp_, "} " ) + aadd( cpp_, " " ) ENDIF - aadd( cpp_, "} " ) - aadd( cpp_, " " ) - /* Insert CONSTRUCTOR - if defined */ lConst := .f. FOR i := 3 TO len( new_ ) - 1 @@ -516,53 +601,105 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) ENDIF ENDIF NEXT - aadd( cpp_, new_[ 1 ] ) // Func definition - aadd( cpp_, new_[ 2 ] ) // { - IF lConst - //IF lObject .or. IsMemObject( cWidget ) - IF lDestructor - aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() );" ) - ENDIF - IF lObject - aadd( cpp_, " QPointer< "+ cWidget +" > pObj = NULL;" ) - ELSE - aadd( cpp_, " void * pObj = NULL;" ) - ENDIF - aadd( cpp_, "#if defined(__debug__)" ) - aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + ' ' + IF( lDestructor, 'GC', 'NON-GC' ) + ': new ' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str );' ) - aadd( cpp_, "#endif" ) - - aadd( cpp_, "" ) - FOR i := 3 TO len( new_ ) - 1 - IF left( ltrim( new_[ i ] ), 2 ) != "//" - IF "hb_retptr(" $ new_[ i ] - s := trim( strtran( new_[ i ], "hb_retptr(", "pObj =" ) ) - s := strtran( s, ");", ";" ) - aadd( cpp_, s ) + IF ( lNewGCtoQT ) + IF lConst + IF lDestructor + aadd( cpp_, "void * gcAllocate_" + cWidget + "( void * pObj )" ) + aadd( cpp_, "{ " ) + IF lObject + aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) hb_gcAllocate( sizeof( QGC_POINTER_" + cWidget + " ), gcFuncs() );" ) ELSE - aadd( cpp_, new_[ i ] ) + aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() );" ) ENDIF + aadd( cpp_, " " ) + aadd( cpp_, " p->ph = pObj;" ) + aadd( cpp_, " p->func = release_" + cWidget +";" ) + IF lObject + aadd( cpp_, " new( & p->pq ) QPointer< "+ cWidget +" >( ( " + cWidget + " * ) pObj );" ) + ENDIF + aadd( cpp_, " #if defined(__debug__)" ) + aadd( cpp_, ' just_debug( "' + ' new_' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() );' ) + aadd( cpp_, " #endif" ) + aadd( cpp_, " return( p ); " ) + aadd( cpp_, "} " ) + aadd( cpp_, " " ) ENDIF - NEXT - aadd( cpp_, "" ) - - aadd( cpp_, "#if defined(__debug__)" ) - aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + ' ' + IF( lDestructor, 'GC', 'NON-GC' ) + ': ' + pad( " ", 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str );' ) - aadd( cpp_, "#endif" ) - - //IF lObject .or. IsMemObject( cWidget ) - IF lDestructor - aadd( cpp_, " p->ph = pObj;" ) - aadd( cpp_, " p->func = release_" + cWidget +";" ) - aadd( cpp_, " " ) - aadd( cpp_, " hb_retptrGC( p );" ) - ELSE - aadd( cpp_, " hb_retptr( pObj );" ) ENDIF - ENDIF - aadd( cpp_, new_[ len( new_ ) ] ) // } + aadd( cpp_, new_[ 1 ] ) // Func definition + aadd( cpp_, new_[ 2 ] ) // { + IF lConst + + aadd( cpp_, " void * pObj = NULL;" ) + + aadd( cpp_, " " ) + FOR i := 3 TO len( new_ ) - 1 + IF left( ltrim( new_[ i ] ), 2 ) != "//" + IF "hb_retptr(" $ new_[ i ] + s := trim( strtran( new_[ i ], "hb_retptr(", "pObj =" ) ) + s := strtran( s, ");", ";" ) + aadd( cpp_, s ) + ELSE + aadd( cpp_, new_[ i ] ) + ENDIF + ENDIF + NEXT + aadd( cpp_, " " ) + IF lDestructor + aadd( cpp_, " hb_retptrGC( gcAllocate_" + cWidget + "( pObj ) );" ) + ELSE + aadd( cpp_, " hb_retptr( pObj );" ) + ENDIF + ENDIF + aadd( cpp_, new_[ len( new_ ) ] ) // } + ELSE + aadd( cpp_, new_[ 1 ] ) // Func definition + aadd( cpp_, new_[ 2 ] ) // { + IF lConst + IF lDestructor + aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() );" ) + ENDIF + IF lObject + aadd( cpp_, " QPointer< "+ cWidget +" > pObj = NULL;" ) + ELSE + aadd( cpp_, " void * pObj = NULL;" ) + ENDIF + + aadd( cpp_, "#if defined(__debug__)" ) + aadd( cpp_, 'just_debug( "' + ' ' + IF( lDestructor, 'GC', 'NON-GC' ) + ': new ' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() );' ) + aadd( cpp_, "#endif" ) + + aadd( cpp_, "" ) + FOR i := 3 TO len( new_ ) - 1 + IF left( ltrim( new_[ i ] ), 2 ) != "//" + IF "hb_retptr(" $ new_[ i ] + s := trim( strtran( new_[ i ], "hb_retptr(", "pObj =" ) ) + s := strtran( s, ");", ";" ) + aadd( cpp_, s ) + ELSE + aadd( cpp_, new_[ i ] ) + ENDIF + ENDIF + NEXT + aadd( cpp_, "" ) + + aadd( cpp_, "#if defined(__debug__)" ) + aadd( cpp_, 'just_debug( "' + ' ' + IF( lDestructor, 'GC', 'NON-GC' ) + ': ' + pad( " ", 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() );' ) + aadd( cpp_, "#endif" ) + + //IF lObject .or. IsMemObject( cWidget ) + IF lDestructor + aadd( cpp_, " p->ph = pObj;" ) + aadd( cpp_, " p->func = release_" + cWidget +";" ) + aadd( cpp_, " " ) + aadd( cpp_, " hb_retptrGC( p );" ) + ELSE + aadd( cpp_, " hb_retptr( pObj );" ) + ENDIF + ENDIF + aadd( cpp_, new_[ len( new_ ) ] ) // } + ENDIF /* Insert Functions */ aeval( txt_, {|e| aadd( cpp_, strtran( e, chr( 13 ), '' ) ) } ) @@ -575,8 +712,6 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) ENDIF /* Build Class PRG Source */ -// cFileCpp := cPathOut + s_PathSep + cWidget + '.cpp' -// CreateTarget( cFileCpp, cpp_ ) /* Distribute in specific lib subfolder */ cFileCpp := GetSourcePathByLib( cWidget, cPathOut, '.cpp' ) CreateTarget( cFileCpp, cpp_ ) @@ -987,7 +1122,7 @@ STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) OTHERWISE /* No attribute is attached to return value */ - IF left( aA[ PRT_CAST ], 1 ) == 'Q' + IF (left( aA[ PRT_CAST ], 1 ) == 'Q') cCmd := Get_Command( aA[ PRT_CAST ], cCmn ) cPrgRet := 'p' + cDocNM @@ -1150,7 +1285,7 @@ STATIC FUNCTION ParseVariables( cProto, cWidget, txt_, doc_, aEnum, func_ ) OTHERWISE /* No attribute is attached to return value */ - IF left( aA[ PRT_CAST ], 1 ) == 'Q' + IF (left( aA[ PRT_CAST ], 1 ) == 'Q') // cCmd := 'hb_retptr( new ' + aA[ PRT_CAST ] + '( ' + cCmn + ' ) )' // cCmd := 'hb_retptrGC( hbqt_pToGCPointer( new ' + aA[ PRT_CAST ] + '( ' + cCmn + ' ) ) )' cCmd := Get_Command( aA[ PRT_CAST ], cCmn ) @@ -1327,6 +1462,8 @@ STATIC FUNCTION DispHelp() cHlp += ' ' + s_NewLine cHlp += ' -c If QT env is set, attempts to compile resulting .cpp' + s_NewLine cHlp += '' + s_NewLine + cHlp += ' -noretobject Skip object returning methods' + s_NewLine + cHlp += '' + s_NewLine OutStd( cHlp ) @@ -1503,6 +1640,13 @@ STATIC FUNCTION Build_GarbageFile( cpp_, cPathOut ) NEXT aadd( txt_, "" ) + IF (lNewGCtoQT) + FOR EACH s IN cpp_ + aadd( txt_, "extern void * gcAllocate_" + s + "( void * pObj );" ) + NEXT + aadd( txt_, "" ) + ENDIF + RETURN CreateTarget( cFile, txt_ ) /*----------------------------------------------------------------------*/ @@ -2193,12 +2337,18 @@ FUNCTION IsMemObject( cWidget ) FUNCTION Get_Command( cWgt, cCmn ) STATIC a_:={} + LOCAL cRet IF ascan( a_, cWgt ) == 0 aadd( a_, cWgt ) //hb_ToOutDebug( pad( cWgt,30 ) + "No " + zWidget ) ENDIF - //RETURN 'hb_retptrGC( hbqt_ptrTOgcpointer( new ' + cWgt + '( ' + cCmn + ' ), "' + cWgt +'" ) )' - RETURN 'hb_retptrGC( hbqt_ptrTOgcpointer( new ' + cWgt + '( ' + cCmn + ' ), release_' + cWgt +' ) )' + IF (lNewGCtoQT) + cRet := 'hb_retptrGC( gcAllocate_' + cWgt + '( new ' + cWgt + '( ' + cCmn + ' ) ) )' + ELSE + cRet := 'hb_retptrGC( hbqt_ptrTOgcpointer( new ' + cWgt + '( ' + cCmn + ' ), release_' + cWgt +' ) )' + ENDIF + + RETURN cRet /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index d89c3ddaf3..826f8390a9 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -61,29 +61,10 @@ #if QT_VERSION >= 0x040500 -//#define __debug__ +// #define __debug__ #if defined(__debug__) - #include - static char str[ 100 ]; - int hb_getMemUsed( void ); -#endif - -#if 0 -#include - -/* global declaration */ -typedef void * ( * QT_PARAM_FUNC ) ( int ); -typedef struct _QT_PARAM_INFO -{ - QT_PARAM_FUNC pFunc; - struct _QT_PARAM_INFO * pNext; - BOOL fInited; -} QT_PARAM_INFO; - -extern QMainWindow * hbqt_par_QMainWindow( int iParam ); -extern void qt_childregister_QMainWindow( QT_PARAM_INFO * paramInfo ); -QWidget * hbqt_par_QWidget( int iParam ); -extern void qt_childregister_QWidget( QT_PARAM_INFO * paramInfo ); + int hb_getMemUsed( void ); + void just_debug( const char * sTraceMsg, ... ); #endif #define QT_G_FUNC( hbfunc ) void hbfunc( void * Cargo ) /* callback function for cleaning garbage memory pointer */ @@ -99,7 +80,6 @@ typedef struct HB_GARBAGE_FUNC( Q_release ); void * hbqt_gcpointer( int iParam ); -void * hbqt_ptrTOgcpointer( void * p, QT_G_FUNC_PTR func ); const HB_GC_FUNCS * gcFuncs( void ); #include "hbqt_garbage.h" diff --git a/harbour/contrib/hbqt/hbqt_destruct.cpp b/harbour/contrib/hbqt/hbqt_destruct.cpp index 7005a3b07e..cc97fa6efd 100644 --- a/harbour/contrib/hbqt/hbqt_destruct.cpp +++ b/harbour/contrib/hbqt/hbqt_destruct.cpp @@ -69,7 +69,7 @@ HB_GARBAGE_FUNC( Q_release ) QGC_POINTER * p = ( QGC_POINTER * ) Cargo; if( p && p->ph ) { - p->func( p->ph ); + p->func( p ); } } @@ -98,54 +98,39 @@ void * hbqt_gcpointer( int iParam ) } } -void * hbqt_ptrTOgcpointer( void * ptr, QT_G_FUNC_PTR func ) -{ - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - p->ph = ptr; - p->func = func; - #if defined(__debug__) -hb_snprintf( str, sizeof(str), " hbqt_ptrTOgcpointer( %p, %p ) %i %i", ptr, func, ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - return p; +#include +#include + +void just_debug( const char * sTraceMsg, ... ) +{ + if( sTraceMsg ) + { + char buffer[ 1024 ]; + va_list ap; + + va_start( ap, sTraceMsg ); + hb_vsnprintf( buffer, sizeof( buffer ), sTraceMsg, ap ); + va_end( ap ); + + OutputDebugString( buffer ); + } } -#if defined(__debug__) - -#include int hb_getMemUsed( void ) { HANDLE hProcess; PROCESS_MEMORY_COUNTERS pmc; int size = 0; - hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | - PROCESS_VM_READ, - FALSE, GetCurrentProcessId() ); - if (NULL == hProcess) + hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, + FALSE, GetCurrentProcessId() ); + if ( NULL == hProcess ) return 0; if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) ) { - #if 0 - printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount ); - printf( "\tPeakWorkingSetSize: 0x%08X\n", - pmc.PeakWorkingSetSize ); - printf( "\tWorkingSetSize: 0x%08X\n", pmc.WorkingSetSize ); - printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n", - pmc.QuotaPeakPagedPoolUsage ); - printf( "\tQuotaPagedPoolUsage: 0x%08X\n", - pmc.QuotaPagedPoolUsage ); - printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n", - pmc.QuotaPeakNonPagedPoolUsage ); - printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n", - pmc.QuotaNonPagedPoolUsage ); - printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage ); - printf( "\tPeakPagefileUsage: 0x%08X\n", - pmc.PeakPagefileUsage ); - #endif - size = ( int ) pmc.WorkingSetSize / 1024 ; } diff --git a/harbour/contrib/hbqt/hbqt_garbage.h b/harbour/contrib/hbqt/hbqt_garbage.h index ffbc82552b..98f3ffb252 100644 --- a/harbour/contrib/hbqt/hbqt_garbage.h +++ b/harbour/contrib/hbqt/hbqt_garbage.h @@ -276,3 +276,270 @@ extern QT_G_FUNC( release_QWindowsXPStyle ); extern QT_G_FUNC( release_QWizard ); extern QT_G_FUNC( release_QWizardPage ); +extern void * gcAllocate_QAbstractButton( void * pObj ); +extern void * gcAllocate_QAbstractItemDelegate( void * pObj ); +extern void * gcAllocate_QAbstractItemModel( void * pObj ); +extern void * gcAllocate_QAbstractItemView( void * pObj ); +extern void * gcAllocate_QAbstractListModel( void * pObj ); +extern void * gcAllocate_QAbstractProxyModel( void * pObj ); +extern void * gcAllocate_QAbstractPrintDialog( void * pObj ); +extern void * gcAllocate_QAbstractScrollArea( void * pObj ); +extern void * gcAllocate_QAbstractSlider( void * pObj ); +extern void * gcAllocate_QAbstractSpinBox( void * pObj ); +extern void * gcAllocate_QAbstractTableModel( void * pObj ); +extern void * gcAllocate_QAbstractTextDocumentLayout( void * pObj ); +extern void * gcAllocate_QAction( void * pObj ); +extern void * gcAllocate_QActionGroup( void * pObj ); +extern void * gcAllocate_QApplication( void * pObj ); +extern void * gcAllocate_QBitArray( void * pObj ); +extern void * gcAllocate_QBitmap( void * pObj ); +extern void * gcAllocate_QBoxLayout( void * pObj ); +extern void * gcAllocate_QBrush( void * pObj ); +extern void * gcAllocate_QButtonGroup( void * pObj ); +extern void * gcAllocate_QByteArray( void * pObj ); +extern void * gcAllocate_QCalendarWidget( void * pObj ); +extern void * gcAllocate_QCheckBox( void * pObj ); +extern void * gcAllocate_QClipboard( void * pObj ); +extern void * gcAllocate_QColor( void * pObj ); +extern void * gcAllocate_QColorDialog( void * pObj ); +extern void * gcAllocate_QComboBox( void * pObj ); +extern void * gcAllocate_QCommandLinkButton( void * pObj ); +extern void * gcAllocate_QCommonStyle( void * pObj ); +extern void * gcAllocate_QCompleter( void * pObj ); +extern void * gcAllocate_QConicalGradient( void * pObj ); +extern void * gcAllocate_QContextMenuEvent( void * pObj ); +extern void * gcAllocate_QCoreApplication( void * pObj ); +extern void * gcAllocate_QCursor( void * pObj ); +extern void * gcAllocate_QDataStream( void * pObj ); +extern void * gcAllocate_QDate( void * pObj ); +extern void * gcAllocate_QDateEdit( void * pObj ); +extern void * gcAllocate_QDateTime( void * pObj ); +extern void * gcAllocate_QDateTimeEdit( void * pObj ); +extern void * gcAllocate_QDesktopWidget( void * pObj ); +extern void * gcAllocate_QDial( void * pObj ); +extern void * gcAllocate_QDialog( void * pObj ); +extern void * gcAllocate_QDir( void * pObj ); +extern void * gcAllocate_QDirModel( void * pObj ); +extern void * gcAllocate_QDockWidget( void * pObj ); +extern void * gcAllocate_QDoubleSpinBox( void * pObj ); +extern void * gcAllocate_QDropEvent( void * pObj ); +extern void * gcAllocate_QDragMoveEvent( void * pObj ); +extern void * gcAllocate_QDragEnterEvent( void * pObj ); +extern void * gcAllocate_QDragLeaveEvent( void * pObj ); +extern void * gcAllocate_QErrorMessage( void * pObj ); +extern void * gcAllocate_QEvent( void * pObj ); +extern void * gcAllocate_QEventLoop( void * pObj ); +extern void * gcAllocate_QFile( void * pObj ); +extern void * gcAllocate_QFileDialog( void * pObj ); +extern void * gcAllocate_QFileInfo( void * pObj ); +extern void * gcAllocate_QFileIconProvider( void * pObj ); +extern void * gcAllocate_QFileSystemModel( void * pObj ); +extern void * gcAllocate_QFocusEvent( void * pObj ); +extern void * gcAllocate_QFocusFrame( void * pObj ); +extern void * gcAllocate_QFont( void * pObj ); +extern void * gcAllocate_QFontComboBox( void * pObj ); +extern void * gcAllocate_QFontDatabase( void * pObj ); +extern void * gcAllocate_QFontDialog( void * pObj ); +extern void * gcAllocate_QFontInfo( void * pObj ); +extern void * gcAllocate_QFontMetrics( void * pObj ); +extern void * gcAllocate_QFontMetricsF( void * pObj ); +extern void * gcAllocate_QFormLayout( void * pObj ); +extern void * gcAllocate_QFrame( void * pObj ); +extern void * gcAllocate_QFtp( void * pObj ); +extern void * gcAllocate_QGradient( void * pObj ); +extern void * gcAllocate_QGridLayout( void * pObj ); +extern void * gcAllocate_QGroupBox( void * pObj ); +extern void * gcAllocate_QHBoxLayout( void * pObj ); +extern void * gcAllocate_QHeaderView( void * pObj ); +extern void * gcAllocate_QHelpEvent( void * pObj ); +extern void * gcAllocate_QHttp( void * pObj ); +extern void * gcAllocate_QHttpRequestHeader( void * pObj ); +extern void * gcAllocate_QHttpResponseHeader( void * pObj ); +extern void * gcAllocate_QIcon( void * pObj ); +extern void * gcAllocate_QInputContext( void * pObj ); +extern void * gcAllocate_QInputMethodEvent( void * pObj ); +extern void * gcAllocate_QImage( void * pObj ); +extern void * gcAllocate_QImageReader( void * pObj ); +extern void * gcAllocate_QImageWriter( void * pObj ); +extern void * gcAllocate_QInputDialog( void * pObj ); +extern void * gcAllocate_QInputEvent( void * pObj ); +extern void * gcAllocate_QIODevice( void * pObj ); +extern void * gcAllocate_QItemSelection( void * pObj ); +extern void * gcAllocate_QItemSelectionModel( void * pObj ); +extern void * gcAllocate_QKeyEvent( void * pObj ); +extern void * gcAllocate_QKeySequence( void * pObj ); +extern void * gcAllocate_QLabel( void * pObj ); +extern void * gcAllocate_QLatin1Char( void * pObj ); +extern void * gcAllocate_QLatin1String( void * pObj ); +extern void * gcAllocate_QLayout( void * pObj ); +extern void * gcAllocate_QLayoutItem( void * pObj ); +extern void * gcAllocate_QLCDNumber( void * pObj ); +extern void * gcAllocate_QLine( void * pObj ); +extern void * gcAllocate_QLineF( void * pObj ); +extern void * gcAllocate_QLinearGradient( void * pObj ); +extern void * gcAllocate_QLineEdit( void * pObj ); +extern void * gcAllocate_QList( void * pObj ); +extern void * gcAllocate_QListView( void * pObj ); +extern void * gcAllocate_QListWidget( void * pObj ); +extern void * gcAllocate_QListWidgetItem( void * pObj ); +extern void * gcAllocate_QLocale( void * pObj ); +extern void * gcAllocate_QMainWindow( void * pObj ); +extern void * gcAllocate_QMatrix( void * pObj ); +extern void * gcAllocate_QMenu( void * pObj ); +extern void * gcAllocate_QMenuBar( void * pObj ); +extern void * gcAllocate_QMessageBox( void * pObj ); +extern void * gcAllocate_QMimeData( void * pObj ); +extern void * gcAllocate_QModelIndex( void * pObj ); +extern void * gcAllocate_QMouseEvent( void * pObj ); +extern void * gcAllocate_QMoveEvent( void * pObj ); +extern void * gcAllocate_QMovie( void * pObj ); +extern void * gcAllocate_QNetworkRequest( void * pObj ); +extern void * gcAllocate_QObject( void * pObj ); +extern void * gcAllocate_QPaintDevice( void * pObj ); +extern void * gcAllocate_QPainterPath( void * pObj ); +extern void * gcAllocate_QPageSetupDialog( void * pObj ); +extern void * gcAllocate_QPainter( void * pObj ); +extern void * gcAllocate_QPaintEvent( void * pObj ); +extern void * gcAllocate_QPalette( void * pObj ); +extern void * gcAllocate_QPen( void * pObj ); +extern void * gcAllocate_QPicture( void * pObj ); +extern void * gcAllocate_QPixmap( void * pObj ); +extern void * gcAllocate_QPoint( void * pObj ); +extern void * gcAllocate_QPointF( void * pObj ); +extern void * gcAllocate_QPolygon( void * pObj ); +extern void * gcAllocate_QPolygonF( void * pObj ); +extern void * gcAllocate_QPrintDialog( void * pObj ); +extern void * gcAllocate_QPrintEngine( void * pObj ); +extern void * gcAllocate_QPrinter( void * pObj ); +extern void * gcAllocate_QPrintPreviewDialog( void * pObj ); +extern void * gcAllocate_QProcess( void * pObj ); +extern void * gcAllocate_QProgressBar( void * pObj ); +extern void * gcAllocate_QProgressDialog( void * pObj ); +extern void * gcAllocate_QPushButton( void * pObj ); +extern void * gcAllocate_QRadialGradient( void * pObj ); +extern void * gcAllocate_QRadioButton( void * pObj ); +extern void * gcAllocate_QRect( void * pObj ); +extern void * gcAllocate_QRectF( void * pObj ); +extern void * gcAllocate_QRegion( void * pObj ); +extern void * gcAllocate_QRegExp( void * pObj ); +extern void * gcAllocate_QResizeEvent( void * pObj ); +extern void * gcAllocate_QResource( void * pObj ); +extern void * gcAllocate_QScrollArea( void * pObj ); +extern void * gcAllocate_QScrollBar( void * pObj ); +extern void * gcAllocate_QSessionManager( void * pObj ); +extern void * gcAllocate_QSignalMapper( void * pObj ); +extern void * gcAllocate_QSize( void * pObj ); +extern void * gcAllocate_QSizeF( void * pObj ); +extern void * gcAllocate_QSizeGrip( void * pObj ); +extern void * gcAllocate_QSizePolicy( void * pObj ); +extern void * gcAllocate_QSlider( void * pObj ); +extern void * gcAllocate_QSound( void * pObj ); +extern void * gcAllocate_QSpacerItem( void * pObj ); +extern void * gcAllocate_QSpinBox( void * pObj ); +extern void * gcAllocate_QSplashScreen( void * pObj ); +extern void * gcAllocate_QSplitter( void * pObj ); +extern void * gcAllocate_QStandardItem( void * pObj ); +extern void * gcAllocate_QStandardItemModel( void * pObj ); +extern void * gcAllocate_QStatusBar( void * pObj ); +extern void * gcAllocate_QStringList( void * pObj ); +extern void * gcAllocate_QStringListModel( void * pObj ); +extern void * gcAllocate_QStyle( void * pObj ); +extern void * gcAllocate_QStyledItemDelegate( void * pObj ); +extern void * gcAllocate_QStyleFactory( void * pObj ); +extern void * gcAllocate_QStyleHintReturn( void * pObj ); +extern void * gcAllocate_QStyleHintReturnMask( void * pObj ); +extern void * gcAllocate_QStyleHintReturnVariant( void * pObj ); +extern void * gcAllocate_QStyleOption( void * pObj ); +extern void * gcAllocate_QStyleOptionButton( void * pObj ); +extern void * gcAllocate_QStyleOptionComboBox( void * pObj ); +extern void * gcAllocate_QStyleOptionComplex( void * pObj ); +extern void * gcAllocate_QStyleOptionDockWidget( void * pObj ); +extern void * gcAllocate_QStyleOptionFocusRect( void * pObj ); +extern void * gcAllocate_QStyleOptionFrame( void * pObj ); +extern void * gcAllocate_QStyleOptionGroupBox( void * pObj ); +extern void * gcAllocate_QStyleOptionHeader( void * pObj ); +extern void * gcAllocate_QStyleOptionMenuItem( void * pObj ); +extern void * gcAllocate_QStyleOptionProgressBar( void * pObj ); +extern void * gcAllocate_QStyleOptionSizeGrip( void * pObj ); +extern void * gcAllocate_QStyleOptionSlider( void * pObj ); +extern void * gcAllocate_QStyleOptionSpinBox( void * pObj ); +extern void * gcAllocate_QStyleOptionTab( void * pObj ); +extern void * gcAllocate_QStyleOptionTabBarBase( void * pObj ); +extern void * gcAllocate_QStyleOptionTabWidgetFrame( void * pObj ); +extern void * gcAllocate_QStyleOptionTitleBar( void * pObj ); +extern void * gcAllocate_QStyleOptionToolBar( void * pObj ); +extern void * gcAllocate_QStyleOptionToolBox( void * pObj ); +extern void * gcAllocate_QStyleOptionToolButton( void * pObj ); +extern void * gcAllocate_QStyleOptionViewItem( void * pObj ); +extern void * gcAllocate_QStylePainter( void * pObj ); +extern void * gcAllocate_QSystemTrayIcon( void * pObj ); +extern void * gcAllocate_QTabBar( void * pObj ); +extern void * gcAllocate_QTableView( void * pObj ); +extern void * gcAllocate_QTableWidget( void * pObj ); +extern void * gcAllocate_QTableWidgetItem( void * pObj ); +extern void * gcAllocate_QTabWidget( void * pObj ); +extern void * gcAllocate_QTableWidgetSelectionRange( void * pObj ); +extern void * gcAllocate_QTextBlock( void * pObj ); +extern void * gcAllocate_QTextBlockFormat( void * pObj ); +extern void * gcAllocate_QTextBlockGroup( void * pObj ); +extern void * gcAllocate_QTextBrowser( void * pObj ); +extern void * gcAllocate_QTextBoundaryFinder( void * pObj ); +extern void * gcAllocate_QTextCharFormat( void * pObj ); +extern void * gcAllocate_QTextCodec( void * pObj ); +extern void * gcAllocate_QTextCursor( void * pObj ); +extern void * gcAllocate_QTextDecoder( void * pObj ); +extern void * gcAllocate_QTextDocument( void * pObj ); +extern void * gcAllocate_QTextDocumentFragment( void * pObj ); +extern void * gcAllocate_QTextDocumentWriter( void * pObj ); +extern void * gcAllocate_QTextEdit( void * pObj ); +extern void * gcAllocate_QTextEncoder( void * pObj ); +extern void * gcAllocate_QTextFormat( void * pObj ); +extern void * gcAllocate_QTextFragment( void * pObj ); +extern void * gcAllocate_QTextFrame( void * pObj ); +extern void * gcAllocate_QTextFrameFormat( void * pObj ); +extern void * gcAllocate_QTextImageFormat( void * pObj ); +extern void * gcAllocate_QTextInlineObject( void * pObj ); +extern void * gcAllocate_QTextItem( void * pObj ); +extern void * gcAllocate_QTextLayout( void * pObj ); +extern void * gcAllocate_QTextLength( void * pObj ); +extern void * gcAllocate_QTextLine( void * pObj ); +extern void * gcAllocate_QTextListFormat( void * pObj ); +extern void * gcAllocate_QTextObject( void * pObj ); +extern void * gcAllocate_QTextOption( void * pObj ); +extern void * gcAllocate_QTextStream( void * pObj ); +extern void * gcAllocate_QTextTableFormat( void * pObj ); +extern void * gcAllocate_QThread( void * pObj ); +extern void * gcAllocate_QTime( void * pObj ); +extern void * gcAllocate_QTimeEdit( void * pObj ); +extern void * gcAllocate_QTimer( void * pObj ); +extern void * gcAllocate_QToolBar( void * pObj ); +extern void * gcAllocate_QToolBox( void * pObj ); +extern void * gcAllocate_QToolButton( void * pObj ); +extern void * gcAllocate_QTransform( void * pObj ); +extern void * gcAllocate_QTranslator( void * pObj ); +extern void * gcAllocate_QTreeView( void * pObj ); +extern void * gcAllocate_QTreeWidget( void * pObj ); +extern void * gcAllocate_QTreeWidgetItem( void * pObj ); +extern void * gcAllocate_QUrl( void * pObj ); +extern void * gcAllocate_QValidator( void * pObj ); +extern void * gcAllocate_QVariant( void * pObj ); +extern void * gcAllocate_QVBoxLayout( void * pObj ); +extern void * gcAllocate_QWebFrame( void * pObj ); +extern void * gcAllocate_QWebHistory( void * pObj ); +extern void * gcAllocate_QWebHistoryInterface( void * pObj ); +extern void * gcAllocate_QWebHistoryItem( void * pObj ); +extern void * gcAllocate_QWebHitTestResult( void * pObj ); +extern void * gcAllocate_QWebPage( void * pObj ); +extern void * gcAllocate_QWebPluginFactory( void * pObj ); +extern void * gcAllocate_QWebSecurityOrigin( void * pObj ); +extern void * gcAllocate_QWebSettings( void * pObj ); +extern void * gcAllocate_QWebView( void * pObj ); +extern void * gcAllocate_QWheelEvent( void * pObj ); +extern void * gcAllocate_QWidget( void * pObj ); +extern void * gcAllocate_QWidgetAction( void * pObj ); +extern void * gcAllocate_QWidgetItem( void * pObj ); +extern void * gcAllocate_QWindowsStyle( void * pObj ); +extern void * gcAllocate_QWindowsXPStyle( void * pObj ); +extern void * gcAllocate_QWizard( void * pObj ); +extern void * gcAllocate_QWizardPage( void * pObj ); + diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index 2400f40015..4497e58e3d 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -1957,11 +1957,9 @@ HB_FUNC( QT_DISCONNECT_SIGNAL ) s_s->listBlock[ i - 1 ] = NULL; s_s->listActv[ i - 1 ] = false; ret = disconnect_signal( object, signal ); - //object->disconnect( signal ); - //object->setProperty( signal, QVariant() ); bFreed = true; #if defined(__debug__) -hb_snprintf( str, sizeof( str ), " QT_DISCONNECT_SIGNAL: %s %s", signal, ret ? "YES" : "NO" ); OutputDebugString( str ); +just_debug( " QT_DISCONNECT_SIGNAL: %s %s", ret ? "YES" : "NO", signal ); #endif } } @@ -2019,7 +2017,6 @@ void release_codeblocks( void ) Events::Events( QObject * parent ) : QObject( parent ) { } - Events::~Events() { listBlock.clear(); @@ -2029,12 +2026,14 @@ Events::~Events() bool Events::eventFilter( QObject * object, QEvent * event ) { QEvent::Type eventtype = event->type(); - -//hb_snprintf( str, sizeof( str ), "0 Events::eventFilter = %i", ( int ) eventtype ); OutputDebugString( str ); - +#if defined(__debug__) +//just_debug( "0 Events::eventFilter = %i", ( int ) eventtype ); +#endif if( ( int ) eventtype == 0 ) { -//hb_snprintf( str, sizeof( str ), "x Events::eventFilter = 0" ); OutputDebugString( str ); +#if defined(__debug__) +//just_debug( "x Events::eventFilter = 0" ); +#endif return false; } @@ -2043,7 +2042,9 @@ bool Events::eventFilter( QObject * object, QEvent * event ) int found = object->property( prop ).toInt(); if( found == 0 ) { -//hb_snprintf( str, sizeof( str ), "f Events::eventFilter = %s %i", " found=0", ( int ) eventtype ); OutputDebugString( str ); +#if defined(__debug__) +//just_debug( "f Events::eventFilter = %s %i", " found=0", ( int ) eventtype ); +#endif return false; } @@ -2053,9 +2054,13 @@ bool Events::eventFilter( QObject * object, QEvent * event ) { PHB_ITEM pObject = hb_itemPutPtr( NULL, object ); PHB_ITEM pEvent = hb_itemPutPtr( NULL, event ); -//hb_snprintf( str, sizeof( str ), "0 Events::eventFilter = %i", ( int ) eventtype ); OutputDebugString( str ); +#if defined(__debug__) +//just_debug( "0 Events::eventFilter = %i", ( int ) eventtype ); +#endif ret = hb_itemGetL( hb_vmEvalBlockV( ( PHB_ITEM ) listBlock.at( found - 1 ), 2, pObject, pEvent ) ); -//hb_snprintf( str, sizeof( str ), "1 Events::eventFilter = %s", ret ? " yes" : " no" ); OutputDebugString( str ); +#if defined(__debug__) +//just_debug( "1 Events::eventFilter = %s", ret ? " yes" : " no" ); +#endif hb_itemRelease( pObject ); hb_itemRelease( pEvent ); @@ -2070,7 +2075,9 @@ bool Events::eventFilter( QObject * object, QEvent * event ) event->ignore(); } } -//hb_snprintf( str, sizeof( str ), "1 Events::eventFilter = %i", ( int ) eventtype ); OutputDebugString( str ); +#if defined(__debug__) +//just_debug( "1 Events::eventFilter = %i", ( int ) eventtype ); +#endif return ret; } @@ -2131,7 +2138,7 @@ HB_FUNC( QT_DISCONNECT_EVENT ) object->setProperty( prop, QVariant() ); bRet = true; #if defined(__debug__) -hb_snprintf( str, sizeof( str ), " QT_DISCONNECT_EVENT: %i", type ); OutputDebugString( str ); +just_debug( " QT_DISCONNECT_EVENT: %i", type ); #endif } hb_retl( bRet ); @@ -2139,24 +2146,17 @@ hb_snprintf( str, sizeof( str ), " QT_DISCONNECT_EVENT: %i", type ); Output /*----------------------------------------------------------------------*/ -HB_FUNC( QT_QDEBUG ) -{ - qDebug( "%s", hb_parcx( 1 ) ); -} - -/*----------------------------------------------------------------------*/ - HbTableView::HbTableView( QWidget * parent ) : QTableView( parent ) { } HbTableView::~HbTableView() { #if defined(__debug__) -hb_snprintf( str, sizeof( str ), "HbTableView::~HbTableView() 0 %i %i", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +just_debug( "HbTableView::~HbTableView() 0 %i %i", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); #endif destroy(); #if defined(__debug__) -hb_snprintf( str, sizeof( str ), "HbTableView::~HbTableView() 1 %i %i", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +just_debug( "HbTableView::~HbTableView() 1 %i %i", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); #endif } void HbTableView::keyPressEvent( QKeyEvent * event ) @@ -2189,7 +2189,7 @@ void HbTableView::resizeEvent( QResizeEvent * event ) } QModelIndex HbTableView::moveCursor( HbTableView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers ) { -//hb_snprintf( str, sizeof( str ), "HbTableView: action=%i %i", cursorAction, QAbstractItemView::MoveDown ); OutputDebugString( str ); +//just_debug( "HbTableView: action=%i %i", cursorAction, QAbstractItemView::MoveDown ); //emit sg_moveCursor( cursorAction, modifiers ); return QTableView::moveCursor( cursorAction, modifiers ); @@ -2204,21 +2204,12 @@ void HbTableView::scrollContentsBy( int x, int y ) } void HbTableView::scrollTo( const QModelIndex & index, QAbstractItemView::ScrollHint hint ) { -//hb_snprintf( str, sizeof( str ), "HbTableView:scrollTo row = %i col = %i", index.row(),index.column() ); OutputDebugString( str ); +//just_debug( "HbTableView:scrollTo row = %i col = %i", index.row(),index.column() ); QTableView::scrollTo( index, hint ); } /*----------------------------------------------------------------------*/ -#if 0 -Qt_DisplayRole 0 Qt_FontRole 6 -Qt_DecorationRole 1 Qt_TextAlignmentRole 7 -Qt_EditRole 2 Qt_BackgroundRole 8 -Qt_ToolTipRole 3 Qt_ForegroundRole 9 -Qt_StatusTipRole 4 Qt_CheckStateRole 10 -Qt_WhatsThisRole 5 Qt_SizeHintRole 13 -#endif - #define HBQT_BRW_CELLVALUE 1001 #define HBQT_BRW_COLCOUNT 1002 @@ -2253,13 +2244,39 @@ QVariant fetchRole( PHB_ITEM block, int what, int par1, int par2 ) hb_itemRelease( p2 ); if( hb_itemType( ret ) & HB_IT_STRING ) + { + #if 0 + char * a = hb_itemGetC( ret ); + vv = a; + hb_xfree( a ); + #else vv = hb_itemGetCPtr( ret ); + #endif +#if defined(__debug__) +//just_debug( " fetchRole[ s = %s ]", hb_itemGetCPtr( ret ) ); +#endif + } else if( hb_itemType( ret ) & HB_IT_LOGICAL ) + { vv = hb_itemGetL( ret ); +#if defined(__debug__) +just_debug( " fetchRole[ l = %i ]", hb_itemGetL( ret ) ); +#endif + } else if( hb_itemType( ret ) & HB_IT_DOUBLE ) + { vv = hb_itemGetND( ret ); +#if defined(__debug__) +just_debug( " fetchRole[ d = %i ]", hb_itemGetND( ret ) ); +#endif + } else if( hb_itemType( ret ) & HB_IT_NUMERIC ) + { vv = hb_itemGetNI( ret ); +#if defined(__debug__) +//just_debug( " fetchRole[ n = %i ]", hb_itemGetNI( ret ) ); +#endif + } } return vv; } @@ -2285,7 +2302,9 @@ Qt::ItemFlags HbDbfModel::flags( const QModelIndex & index ) const QVariant HbDbfModel::data( const QModelIndex & index, int role ) const { -//hb_snprintf( str, sizeof( str ), "data - row=%i col=%i role=%i", index.row(), index.column(), role ); OutputDebugString( str ); +#if defined(__debug__) +//just_debug( "data - row=%i col=%i role=%i", index.row(), index.column(), role ); +#endif if( !index.isValid() ) return( QVariant() ); @@ -2334,8 +2353,9 @@ QVariant HbDbfModel::data( const QModelIndex & index, int role ) const QVariant HbDbfModel::headerData( int section, Qt::Orientation orientation, int role ) const { -//hb_snprintf( str, sizeof( str ), "headerData - section=%i orient=%i role=%i name=%s", section, orientation, role, objectName() ); OutputDebugString( str ); - +#if defined(__debug__) +//just_debug( "headerData - section=%i orient=%i role=%i name=%s", section, orientation, role, objectName() ); +#endif if( orientation == Qt::Horizontal ) { switch( role ) @@ -2430,9 +2450,7 @@ int HbDbfModel::columnCount( const QModelIndex & /*parent = QModelIndex()*/ ) co QModelIndex HbDbfModel::index( int row, int column, const QModelIndex & parent ) const { -//hb_snprintf( str, sizeof( str ), "index: row=%i col=%i", row, column ); OutputDebugString( str ); HB_SYMBOL_UNUSED( parent ); - return( createIndex( row, column, row * column ) ); } @@ -2480,12 +2498,12 @@ MyMainWindow::MyMainWindow( PHB_ITEM pBlock, int iThreadID ) MyMainWindow::~MyMainWindow( void ) { #if defined(__debug__) -hb_snprintf( str, sizeof( str ), " MyMainWindow::~MyMainWindow 0" ); OutputDebugString( str ); +just_debug( " MyMainWindow::~MyMainWindow 0" ); #endif hb_itemRelease( block ); destroy(); #if defined(__debug__) -hb_snprintf( str, sizeof( str ), " MyMainWindow::~MyMainWindow 1" ); OutputDebugString( str ); +just_debug( " MyMainWindow::~MyMainWindow 1" ); #endif } void MyMainWindow::paintEvent( QPaintEvent * event ) @@ -2522,7 +2540,7 @@ void MyMainWindow::paintEvent( QPaintEvent * event ) } bool MyMainWindow::event( QEvent * event ) { -//hb_snprintf( str, sizeof( str ), " event(%i) %i", threadID, (int) event->type() ); OutputDebugString( str ); +//just_debug( " event(%i) %i", threadID, (int) event->type() ); hb_threadMutexLock( s_mutex ); #if 0 if( hb_vmRequestReenter() ) @@ -2677,7 +2695,7 @@ void MyMainWindow::resizeEvent( QResizeEvent * event ) void MyMainWindow::closeEvent( QCloseEvent * event ) { #if defined(__debug__) -hb_snprintf( str, sizeof( str ), " close event(%i)", threadID ); OutputDebugString( str ); +just_debug( " close event(%i)", threadID ); #endif hb_threadMutexLock( s_mutex ); if( hb_vmRequestReenter() ) diff --git a/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp b/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp index 665f5f3910..6dbff1d581 100644 --- a/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp +++ b/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp @@ -107,7 +107,8 @@ HB_FUNC( QT_HBDBFMODEL_RESET ) HB_FUNC( QT_HBDBFMODEL_INDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_HbDbfModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), QModelIndex() ) ), release_QModelIndex ) ); +// BI hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_HbDbfModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), QModelIndex() ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_HbDbfModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), QModelIndex() ) ) ) ); } HB_FUNC( QT_HBDBFMODEL_HBSETROWCOLUMNS ) @@ -117,37 +118,15 @@ HB_FUNC( QT_HBDBFMODEL_HBSETROWCOLUMNS ) HB_FUNC( QT_HBDBFMODEL_DESTROY ) { +// BI:TODO fix the GPF hbqt_par_HbDbfModel( 1 )->~HbDbfModel(); +// BUT WITHOUT THIS FM STATISTICS GENERATE A BIG LOG SO THIS IS NOT THE OPTION NOW hbqt_par_HbDbfModel( 1 )->~HbDbfModel(); } QT_G_FUNC( release_QAbstractItemModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractItemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractItemModel * ) ph )->~QAbstractItemModel(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractItemModel" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractItemModel" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTITEMMODEL ) @@ -158,7 +137,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_BUDDY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->buddy( *hbqt_par_QModelIndex( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->buddy( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -182,7 +161,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_COLUMNCOUNT ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QAbstractItemModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QAbstractItemModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ) ) ); } /* @@ -230,7 +209,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_HASINDEX ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_HEADERDATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QAbstractItemModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QAbstractItemModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ) ) ); } /* @@ -238,7 +217,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_HEADERDATA ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_INDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ) ) ); } /* @@ -278,7 +257,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_INSERTROWS ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_MIMETYPES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QAbstractItemModel( 1 )->mimeTypes() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QAbstractItemModel( 1 )->mimeTypes() ) ) ); } /* @@ -286,7 +265,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_MIMETYPES ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_PARENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -358,7 +337,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_SETSUPPORTEDDRAGACTIONS ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_SIBLING ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->sibling( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QModelIndex( 4 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->sibling( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QModelIndex( 4 ) ) ) ) ); } /* @@ -374,7 +353,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_SORT ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_SPAN ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QAbstractItemModel( 1 )->span( *hbqt_par_QModelIndex( 2 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemModel( 1 )->span( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QAbstractListModel.cpp b/harbour/contrib/hbqt/qtcore/QAbstractListModel.cpp index bf4cdb24ce..3eab5eaa39 100644 --- a/harbour/contrib/hbqt/qtcore/QAbstractListModel.cpp +++ b/harbour/contrib/hbqt/qtcore/QAbstractListModel.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QAbstractListModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractListModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractListModel * ) ph )->~QAbstractListModel(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractListModel" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractListModel" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTLISTMODEL ) @@ -113,7 +89,7 @@ HB_FUNC( QT_QABSTRACTLISTMODEL ) */ HB_FUNC( QT_QABSTRACTLISTMODEL_INDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractListModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractListModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QAbstractTableModel.cpp b/harbour/contrib/hbqt/qtcore/QAbstractTableModel.cpp index 4a643dee13..2375e48702 100644 --- a/harbour/contrib/hbqt/qtcore/QAbstractTableModel.cpp +++ b/harbour/contrib/hbqt/qtcore/QAbstractTableModel.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QAbstractTableModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractTableModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractTableModel * ) ph )->~QAbstractTableModel(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractTableModel" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractTableModel" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTTABLEMODEL ) @@ -113,7 +89,7 @@ HB_FUNC( QT_QABSTRACTTABLEMODEL ) */ HB_FUNC( QT_QABSTRACTTABLEMODEL_INDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractTableModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractTableModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QBitArray.cpp b/harbour/contrib/hbqt/qtcore/QBitArray.cpp index b01bd6a593..c48b7edf43 100644 --- a/harbour/contrib/hbqt/qtcore/QBitArray.cpp +++ b/harbour/contrib/hbqt/qtcore/QBitArray.cpp @@ -78,40 +78,48 @@ QT_G_FUNC( release_QBitArray ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QBitArray %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QBitArray p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QBitArray ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QBitArray * ) ph )->~QBitArray(); - ph = NULL; + ( ( QBitArray * ) p->ph )->~QBitArray(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QBitArray Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QBitArray %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QBitArray" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QBitArray Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QBitArray" ); + #endif } } +void * gcAllocate_QBitArray( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QBitArray; + #if defined(__debug__) + just_debug( " new_QBitArray %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QBITARRAY ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QBitArray %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QBitArray() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QBitArray; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QBitArray( pObj ) ); } /* * bool at ( int i ) const diff --git a/harbour/contrib/hbqt/qtcore/QByteArray.cpp b/harbour/contrib/hbqt/qtcore/QByteArray.cpp index 76e1fc0563..d3f276131e 100644 --- a/harbour/contrib/hbqt/qtcore/QByteArray.cpp +++ b/harbour/contrib/hbqt/qtcore/QByteArray.cpp @@ -96,47 +96,55 @@ QT_G_FUNC( release_QByteArray ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QByteArray %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QByteArray p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QByteArray ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QByteArray * ) ph )->~QByteArray(); - ph = NULL; + ( ( QByteArray * ) p->ph )->~QByteArray(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QByteArray Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QByteArray %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QByteArray" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QByteArray Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QByteArray" ); + #endif } } +void * gcAllocate_QByteArray( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QByteArray; + #if defined(__debug__) + just_debug( " new_QByteArray %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QBYTEARRAY ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QByteArray %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QByteArray() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QByteArray; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QByteArray( pObj ) ); } /* * QByteArray & append ( const QByteArray & ba ) */ HB_FUNC( QT_QBYTEARRAY_APPEND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->append( *hbqt_par_QByteArray( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( *hbqt_par_QByteArray( 2 ) ) ) ) ); } /* @@ -144,7 +152,7 @@ HB_FUNC( QT_QBYTEARRAY_APPEND ) */ HB_FUNC( QT_QBYTEARRAY_APPEND_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_QString( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -152,7 +160,7 @@ HB_FUNC( QT_QBYTEARRAY_APPEND_1 ) */ HB_FUNC( QT_QBYTEARRAY_APPEND_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_char( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_char( 2 ) ) ) ) ); } /* @@ -160,7 +168,7 @@ HB_FUNC( QT_QBYTEARRAY_APPEND_2 ) */ HB_FUNC( QT_QBYTEARRAY_APPEND_3 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_char( 2 ), hb_parni( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_char( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -168,7 +176,7 @@ HB_FUNC( QT_QBYTEARRAY_APPEND_3 ) */ HB_FUNC( QT_QBYTEARRAY_APPEND_4 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->append( ( char ) hb_parni( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( ( char ) hb_parni( 2 ) ) ) ) ); } /* @@ -288,7 +296,7 @@ HB_FUNC( QT_QBYTEARRAY_ENDSWITH_2 ) */ HB_FUNC( QT_QBYTEARRAY_FILL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->fill( ( char ) hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->fill( ( char ) hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ) ) ) ); } /* @@ -328,7 +336,7 @@ HB_FUNC( QT_QBYTEARRAY_INDEXOF_3 ) */ HB_FUNC( QT_QBYTEARRAY_INSERT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), *hbqt_par_QByteArray( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); } /* @@ -336,7 +344,7 @@ HB_FUNC( QT_QBYTEARRAY_INSERT ) */ HB_FUNC( QT_QBYTEARRAY_INSERT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), hbqt_par_QString( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* @@ -344,7 +352,7 @@ HB_FUNC( QT_QBYTEARRAY_INSERT_1 ) */ HB_FUNC( QT_QBYTEARRAY_INSERT_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), hbqt_par_char( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), hbqt_par_char( 3 ) ) ) ) ); } /* @@ -352,7 +360,7 @@ HB_FUNC( QT_QBYTEARRAY_INSERT_2 ) */ HB_FUNC( QT_QBYTEARRAY_INSERT_3 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), ( char ) hb_parni( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), ( char ) hb_parni( 3 ) ) ) ) ); } /* @@ -408,7 +416,7 @@ HB_FUNC( QT_QBYTEARRAY_LASTINDEXOF_3 ) */ HB_FUNC( QT_QBYTEARRAY_LEFT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->left( hb_parni( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->left( hb_parni( 2 ) ) ) ) ); } /* @@ -416,7 +424,7 @@ HB_FUNC( QT_QBYTEARRAY_LEFT ) */ HB_FUNC( QT_QBYTEARRAY_LEFTJUSTIFIED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->leftJustified( hb_parni( 2 ), ( char ) hb_parni( 3 ), hb_parl( 4 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->leftJustified( hb_parni( 2 ), ( char ) hb_parni( 3 ), hb_parl( 4 ) ) ) ) ); } /* @@ -432,7 +440,7 @@ HB_FUNC( QT_QBYTEARRAY_LENGTH ) */ HB_FUNC( QT_QBYTEARRAY_MID ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->mid( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->mid( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ) ) ) ); } /* @@ -440,7 +448,7 @@ HB_FUNC( QT_QBYTEARRAY_MID ) */ HB_FUNC( QT_QBYTEARRAY_PREPEND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( *hbqt_par_QByteArray( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( *hbqt_par_QByteArray( 2 ) ) ) ) ); } /* @@ -448,7 +456,7 @@ HB_FUNC( QT_QBYTEARRAY_PREPEND ) */ HB_FUNC( QT_QBYTEARRAY_PREPEND_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( hbqt_par_char( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( hbqt_par_char( 2 ) ) ) ) ); } /* @@ -456,7 +464,7 @@ HB_FUNC( QT_QBYTEARRAY_PREPEND_1 ) */ HB_FUNC( QT_QBYTEARRAY_PREPEND_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( ( char ) hb_parni( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( ( char ) hb_parni( 2 ) ) ) ) ); } /* @@ -512,7 +520,7 @@ HB_FUNC( QT_QBYTEARRAY_PUSH_FRONT_2 ) */ HB_FUNC( QT_QBYTEARRAY_REMOVE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->remove( hb_parni( 2 ), hb_parni( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->remove( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -520,7 +528,7 @@ HB_FUNC( QT_QBYTEARRAY_REMOVE ) */ HB_FUNC( QT_QBYTEARRAY_REPEATED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->repeated( hb_parni( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->repeated( hb_parni( 2 ) ) ) ) ); } /* @@ -528,7 +536,7 @@ HB_FUNC( QT_QBYTEARRAY_REPEATED ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QByteArray( 4 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QByteArray( 4 ) ) ) ) ); } /* @@ -536,7 +544,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hb_parni( 2 ), hb_parni( 3 ), hbqt_par_char( 4 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hb_parni( 2 ), hb_parni( 3 ), hbqt_par_char( 4 ) ) ) ) ); } /* @@ -544,7 +552,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_1 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( *hbqt_par_QByteArray( 2 ), *hbqt_par_QByteArray( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( *hbqt_par_QByteArray( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); } /* @@ -552,7 +560,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_2 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_3 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), *hbqt_par_QByteArray( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); } /* @@ -560,7 +568,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_3 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_4 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), hb_parni( 3 ), hbqt_par_char( 4 ), hb_parni( 5 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), hb_parni( 3 ), hbqt_par_char( 4 ), hb_parni( 5 ) ) ) ) ); } /* @@ -568,7 +576,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_4 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_5 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( *hbqt_par_QByteArray( 2 ), hbqt_par_char( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( *hbqt_par_QByteArray( 2 ), hbqt_par_char( 3 ) ) ) ) ); } /* @@ -576,7 +584,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_5 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_6 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_QString( 2 ), *hbqt_par_QByteArray( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_QString( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); } /* @@ -584,7 +592,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_6 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_7 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_QString( 2 ), hbqt_par_char( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_QString( 2 ), hbqt_par_char( 3 ) ) ) ) ); } /* @@ -592,7 +600,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_7 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_8 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), hbqt_par_char( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), hbqt_par_char( 3 ) ) ) ) ); } /* @@ -600,7 +608,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_8 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_9 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), *hbqt_par_QByteArray( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); } /* @@ -608,7 +616,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_9 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_10 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), hbqt_par_QString( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* @@ -616,7 +624,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_10 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_11 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), hbqt_par_char( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), hbqt_par_char( 3 ) ) ) ) ); } /* @@ -624,7 +632,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_11 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_12 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), ( char ) hb_parni( 3 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), ( char ) hb_parni( 3 ) ) ) ) ); } /* @@ -648,7 +656,7 @@ HB_FUNC( QT_QBYTEARRAY_RESIZE ) */ HB_FUNC( QT_QBYTEARRAY_RIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->right( hb_parni( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->right( hb_parni( 2 ) ) ) ) ); } /* @@ -656,7 +664,7 @@ HB_FUNC( QT_QBYTEARRAY_RIGHT ) */ HB_FUNC( QT_QBYTEARRAY_RIGHTJUSTIFIED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->rightJustified( hb_parni( 2 ), ( char ) hb_parni( 3 ), hb_parl( 4 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->rightJustified( hb_parni( 2 ), ( char ) hb_parni( 3 ), hb_parl( 4 ) ) ) ) ); } /* @@ -664,7 +672,7 @@ HB_FUNC( QT_QBYTEARRAY_RIGHTJUSTIFIED ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); } /* @@ -672,7 +680,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); } /* @@ -680,7 +688,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_1 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); } /* @@ -688,7 +696,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_2 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_3 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); } /* @@ -696,7 +704,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_3 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_4 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( ( qlonglong ) hb_parnint( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( ( qlonglong ) hb_parnint( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); } /* @@ -704,7 +712,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_4 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_5 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( ( qulonglong ) hb_parnint( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( ( qulonglong ) hb_parnint( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); } /* @@ -712,7 +720,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_5 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_6 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parnd( 2 ), ( char ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : 6 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parnd( 2 ), ( char ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : 6 ) ) ) ) ); } /* @@ -720,7 +728,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_6 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_7 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parnd( 2 ), ( char ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : 6 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parnd( 2 ), ( char ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : 6 ) ) ) ) ); } /* @@ -728,7 +736,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_7 ) */ HB_FUNC( QT_QBYTEARRAY_SIMPLIFIED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->simplified() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->simplified() ) ) ); } /* @@ -776,7 +784,7 @@ HB_FUNC( QT_QBYTEARRAY_STARTSWITH_2 ) */ HB_FUNC( QT_QBYTEARRAY_TOBASE64 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->toBase64() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toBase64() ) ) ); } /* @@ -808,7 +816,7 @@ HB_FUNC( QT_QBYTEARRAY_TOFLOAT ) */ HB_FUNC( QT_QBYTEARRAY_TOHEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->toHex() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toHex() ) ) ); } /* @@ -852,7 +860,7 @@ HB_FUNC( QT_QBYTEARRAY_TOLONGLONG ) */ HB_FUNC( QT_QBYTEARRAY_TOLOWER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->toLower() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toLower() ) ) ); } /* @@ -860,7 +868,7 @@ HB_FUNC( QT_QBYTEARRAY_TOLOWER ) */ HB_FUNC( QT_QBYTEARRAY_TOPERCENTENCODING ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->toPercentEncoding( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QByteArray( 2 ) : QByteArray() ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QByteArray( 3 ) : QByteArray() ), ( char ) hb_parni( 4 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toPercentEncoding( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QByteArray( 2 ) : QByteArray() ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QByteArray( 3 ) : QByteArray() ), ( char ) hb_parni( 4 ) ) ) ) ); } /* @@ -928,7 +936,7 @@ HB_FUNC( QT_QBYTEARRAY_TOUSHORT ) */ HB_FUNC( QT_QBYTEARRAY_TOUPPER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->toUpper() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toUpper() ) ) ); } /* @@ -936,7 +944,7 @@ HB_FUNC( QT_QBYTEARRAY_TOUPPER ) */ HB_FUNC( QT_QBYTEARRAY_TRIMMED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QByteArray( 1 )->trimmed() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->trimmed() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QCoreApplication.cpp b/harbour/contrib/hbqt/qtcore/QCoreApplication.cpp index 47779bcf07..93d0e67dbb 100644 --- a/harbour/contrib/hbqt/qtcore/QCoreApplication.cpp +++ b/harbour/contrib/hbqt/qtcore/QCoreApplication.cpp @@ -97,31 +97,7 @@ QT_G_FUNC( release_QCoreApplication ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QCoreApplication %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QCoreApplication * ) ph )->~QCoreApplication(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QCoreApplication" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QCoreApplication" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QCOREAPPLICATION ) @@ -188,7 +164,7 @@ HB_FUNC( QT_QCOREAPPLICATION_APPLICATIONVERSION ) */ HB_FUNC( QT_QCOREAPPLICATION_ARGUMENTS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QCoreApplication( 1 )->arguments() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QCoreApplication( 1 )->arguments() ) ) ); } /* @@ -252,7 +228,7 @@ HB_FUNC( QT_QCOREAPPLICATION_INSTANCE ) */ HB_FUNC( QT_QCOREAPPLICATION_LIBRARYPATHS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QCoreApplication( 1 )->libraryPaths() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QCoreApplication( 1 )->libraryPaths() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QDataStream.cpp b/harbour/contrib/hbqt/qtcore/QDataStream.cpp index ee65e4d26c..4907ce4f00 100644 --- a/harbour/contrib/hbqt/qtcore/QDataStream.cpp +++ b/harbour/contrib/hbqt/qtcore/QDataStream.cpp @@ -86,40 +86,48 @@ QT_G_FUNC( release_QDataStream ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDataStream %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDataStream p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QDataStream ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QDataStream * ) ph )->~QDataStream(); - ph = NULL; + ( ( QDataStream * ) p->ph )->~QDataStream(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDataStream Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDataStream %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDataStream" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDataStream Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDataStream" ); + #endif } } +void * gcAllocate_QDataStream( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDataStream; + #if defined(__debug__) + just_debug( " new_QDataStream %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDATASTREAM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDataStream %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QDataStream() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDataStream; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDataStream( pObj ) ); } /* * bool atEnd () const diff --git a/harbour/contrib/hbqt/qtcore/QDate.cpp b/harbour/contrib/hbqt/qtcore/QDate.cpp index c172aec0ea..d37c39a773 100644 --- a/harbour/contrib/hbqt/qtcore/QDate.cpp +++ b/harbour/contrib/hbqt/qtcore/QDate.cpp @@ -81,47 +81,55 @@ QT_G_FUNC( release_QDate ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDate %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDate p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QDate ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QDate * ) ph )->~QDate(); - ph = NULL; + ( ( QDate * ) p->ph )->~QDate(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDate Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDate %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDate" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDate Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDate" ); + #endif } } +void * gcAllocate_QDate( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDate; + #if defined(__debug__) + just_debug( " new_QDate %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDATE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDate %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QDate() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDate; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDate( pObj ) ); } /* * QDate addDays ( int ndays ) const */ HB_FUNC( QT_QDATE_ADDDAYS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QDate( 1 )->addDays( hb_parni( 2 ) ) ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addDays( hb_parni( 2 ) ) ) ) ); } /* @@ -129,7 +137,7 @@ HB_FUNC( QT_QDATE_ADDDAYS ) */ HB_FUNC( QT_QDATE_ADDMONTHS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QDate( 1 )->addMonths( hb_parni( 2 ) ) ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addMonths( hb_parni( 2 ) ) ) ) ); } /* @@ -137,7 +145,7 @@ HB_FUNC( QT_QDATE_ADDMONTHS ) */ HB_FUNC( QT_QDATE_ADDYEARS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QDate( 1 )->addYears( hb_parni( 2 ) ) ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addYears( hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QDateTime.cpp b/harbour/contrib/hbqt/qtcore/QDateTime.cpp index 9b8c8ad617..731dcc46c3 100644 --- a/harbour/contrib/hbqt/qtcore/QDateTime.cpp +++ b/harbour/contrib/hbqt/qtcore/QDateTime.cpp @@ -81,47 +81,55 @@ QT_G_FUNC( release_QDateTime ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDateTime %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTime p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTime ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QDateTime * ) ph )->~QDateTime(); - ph = NULL; + ( ( QDateTime * ) p->ph )->~QDateTime(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTime Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDateTime %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDateTime" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTime Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDateTime" ); + #endif } } +void * gcAllocate_QDateTime( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDateTime; + #if defined(__debug__) + just_debug( " new_QDateTime %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDATETIME ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDateTime %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QDateTime* ) new QDateTime() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDateTime; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDateTime( pObj ) ); } /* * QDateTime addDays ( int ndays ) const */ HB_FUNC( QT_QDATETIME_ADDDAYS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->addDays( hb_parni( 2 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addDays( hb_parni( 2 ) ) ) ) ); } /* @@ -129,7 +137,7 @@ HB_FUNC( QT_QDATETIME_ADDDAYS ) */ HB_FUNC( QT_QDATETIME_ADDMSECS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->addMSecs( hb_parnint( 2 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addMSecs( hb_parnint( 2 ) ) ) ) ); } /* @@ -137,7 +145,7 @@ HB_FUNC( QT_QDATETIME_ADDMSECS ) */ HB_FUNC( QT_QDATETIME_ADDMONTHS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->addMonths( hb_parni( 2 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addMonths( hb_parni( 2 ) ) ) ) ); } /* @@ -145,7 +153,7 @@ HB_FUNC( QT_QDATETIME_ADDMONTHS ) */ HB_FUNC( QT_QDATETIME_ADDSECS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->addSecs( hb_parni( 2 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addSecs( hb_parni( 2 ) ) ) ) ); } /* @@ -153,7 +161,7 @@ HB_FUNC( QT_QDATETIME_ADDSECS ) */ HB_FUNC( QT_QDATETIME_ADDYEARS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->addYears( hb_parni( 2 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addYears( hb_parni( 2 ) ) ) ) ); } /* @@ -161,7 +169,7 @@ HB_FUNC( QT_QDATETIME_ADDYEARS ) */ HB_FUNC( QT_QDATETIME_DATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QDateTime( 1 )->date() ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QDateTime( 1 )->date() ) ) ); } /* @@ -233,7 +241,7 @@ HB_FUNC( QT_QDATETIME_SETTIME_T ) */ HB_FUNC( QT_QDATETIME_TIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QDateTime( 1 )->time() ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QDateTime( 1 )->time() ) ) ); } /* @@ -249,7 +257,7 @@ HB_FUNC( QT_QDATETIME_TIMESPEC ) */ HB_FUNC( QT_QDATETIME_TOLOCALTIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->toLocalTime() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toLocalTime() ) ) ); } /* @@ -273,7 +281,7 @@ HB_FUNC( QT_QDATETIME_TOSTRING_1 ) */ HB_FUNC( QT_QDATETIME_TOTIMESPEC ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->toTimeSpec( ( Qt::TimeSpec ) hb_parni( 2 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toTimeSpec( ( Qt::TimeSpec ) hb_parni( 2 ) ) ) ) ); } /* @@ -289,7 +297,7 @@ HB_FUNC( QT_QDATETIME_TOTIME_T ) */ HB_FUNC( QT_QDATETIME_TOUTC ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->toUTC() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toUTC() ) ) ); } /* @@ -297,7 +305,7 @@ HB_FUNC( QT_QDATETIME_TOUTC ) */ HB_FUNC( QT_QDATETIME_CURRENTDATETIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->currentDateTime() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->currentDateTime() ) ) ); } /* @@ -305,7 +313,7 @@ HB_FUNC( QT_QDATETIME_CURRENTDATETIME ) */ HB_FUNC( QT_QDATETIME_FROMSTRING ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::DateFormat ) hb_parni( 3 ) : ( Qt::DateFormat ) Qt::TextDate ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::DateFormat ) hb_parni( 3 ) : ( Qt::DateFormat ) Qt::TextDate ) ) ) ) ); } /* @@ -313,7 +321,7 @@ HB_FUNC( QT_QDATETIME_FROMSTRING ) */ HB_FUNC( QT_QDATETIME_FROMSTRING_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->fromString( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromString( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* @@ -321,7 +329,7 @@ HB_FUNC( QT_QDATETIME_FROMSTRING_1 ) */ HB_FUNC( QT_QDATETIME_FROMTIME_T ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTime( 1 )->fromTime_t( hb_parni( 2 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromTime_t( hb_parni( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QDir.cpp b/harbour/contrib/hbqt/qtcore/QDir.cpp index ad129a2fe9..b10d708991 100644 --- a/harbour/contrib/hbqt/qtcore/QDir.cpp +++ b/harbour/contrib/hbqt/qtcore/QDir.cpp @@ -87,40 +87,48 @@ QT_G_FUNC( release_QDir ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDir %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDir p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QDir ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QDir * ) ph )->~QDir(); - ph = NULL; + ( ( QDir * ) p->ph )->~QDir(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDir Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDir %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDir" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDir Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDir" ); + #endif } } +void * gcAllocate_QDir( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDir; + #if defined(__debug__) + just_debug( " new_QDir %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDIR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDir %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QDir( hbqt_par_QString( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDir; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDir( pObj ) ); } /* * QString absoluteFilePath ( const QString & fileName ) const @@ -183,7 +191,7 @@ HB_FUNC( QT_QDIR_DIRNAME ) */ HB_FUNC( QT_QDIR_ENTRYLIST ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QDir( 1 )->entryList( *hbqt_par_QStringList( 2 ), ( HB_ISNUM( 3 ) ? ( QDir::Filters ) hb_parni( 3 ) : ( QDir::Filters ) QDir::NoFilter ), ( HB_ISNUM( 4 ) ? ( QDir::SortFlags ) hb_parni( 4 ) : ( QDir::SortFlags ) QDir::NoSort ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->entryList( *hbqt_par_QStringList( 2 ), ( HB_ISNUM( 3 ) ? ( QDir::Filters ) hb_parni( 3 ) : ( QDir::Filters ) QDir::NoFilter ), ( HB_ISNUM( 4 ) ? ( QDir::SortFlags ) hb_parni( 4 ) : ( QDir::SortFlags ) QDir::NoSort ) ) ) ) ); } /* @@ -191,7 +199,7 @@ HB_FUNC( QT_QDIR_ENTRYLIST ) */ HB_FUNC( QT_QDIR_ENTRYLIST_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QDir( 1 )->entryList( ( HB_ISNUM( 2 ) ? ( QDir::Filters ) hb_parni( 2 ) : ( QDir::Filters ) QDir::NoFilter ), ( HB_ISNUM( 3 ) ? ( QDir::SortFlags ) hb_parni( 3 ) : ( QDir::SortFlags ) QDir::NoSort ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->entryList( ( HB_ISNUM( 2 ) ? ( QDir::Filters ) hb_parni( 2 ) : ( QDir::Filters ) QDir::NoFilter ), ( HB_ISNUM( 3 ) ? ( QDir::SortFlags ) hb_parni( 3 ) : ( QDir::SortFlags ) QDir::NoSort ) ) ) ) ); } /* @@ -287,7 +295,7 @@ HB_FUNC( QT_QDIR_MKPATH ) */ HB_FUNC( QT_QDIR_NAMEFILTERS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QDir( 1 )->nameFilters() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->nameFilters() ) ) ); } /* @@ -407,7 +415,7 @@ HB_FUNC( QT_QDIR_CLEANPATH ) */ HB_FUNC( QT_QDIR_CURRENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDir( hbqt_par_QDir( 1 )->current() ), release_QDir ) ); + hb_retptrGC( gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->current() ) ) ); } /* @@ -431,7 +439,7 @@ HB_FUNC( QT_QDIR_FROMNATIVESEPARATORS ) */ HB_FUNC( QT_QDIR_HOME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDir( hbqt_par_QDir( 1 )->home() ), release_QDir ) ); + hb_retptrGC( gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->home() ) ) ); } /* @@ -479,7 +487,7 @@ HB_FUNC( QT_QDIR_MATCH_1 ) */ HB_FUNC( QT_QDIR_ROOT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDir( hbqt_par_QDir( 1 )->root() ), release_QDir ) ); + hb_retptrGC( gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->root() ) ) ); } /* @@ -495,7 +503,7 @@ HB_FUNC( QT_QDIR_ROOTPATH ) */ HB_FUNC( QT_QDIR_SEARCHPATHS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QDir( 1 )->searchPaths( hbqt_par_QString( 2 ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->searchPaths( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -519,7 +527,7 @@ HB_FUNC( QT_QDIR_SETSEARCHPATHS ) */ HB_FUNC( QT_QDIR_TEMP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDir( hbqt_par_QDir( 1 )->temp() ), release_QDir ) ); + hb_retptrGC( gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->temp() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QEvent.cpp b/harbour/contrib/hbqt/qtcore/QEvent.cpp index d324c15cfa..10f8387647 100644 --- a/harbour/contrib/hbqt/qtcore/QEvent.cpp +++ b/harbour/contrib/hbqt/qtcore/QEvent.cpp @@ -82,40 +82,48 @@ QT_G_FUNC( release_QEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QEvent p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QEvent ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QEvent * ) ph )->~QEvent(); - ph = NULL; + ( ( QEvent * ) p->ph )->~QEvent(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QEvent Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QEvent" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QEvent Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QEvent" ); + #endif } } +void * gcAllocate_QEvent( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QEvent; + #if defined(__debug__) + just_debug( " new_QEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QEVENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QEvent* ) new QEvent( ( QEvent::Type ) hb_parni( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QEvent; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QEvent( pObj ) ); } /* * void accept () diff --git a/harbour/contrib/hbqt/qtcore/QEventLoop.cpp b/harbour/contrib/hbqt/qtcore/QEventLoop.cpp index 688a3f1ab9..fac245e7cb 100644 --- a/harbour/contrib/hbqt/qtcore/QEventLoop.cpp +++ b/harbour/contrib/hbqt/qtcore/QEventLoop.cpp @@ -81,52 +81,69 @@ * ~QEventLoop () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QEventLoop > pq; +} QGC_POINTER_QEventLoop; + QT_G_FUNC( release_QEventLoop ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QEventLoop %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QEventLoop * p = ( QGC_POINTER_QEventLoop * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QEventLoop p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QEventLoop ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QEventLoop * ) ph )->~QEventLoop(); - ph = NULL; + ( ( QEventLoop * ) p->ph )->~QEventLoop(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QEventLoop Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QEventLoop %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QEventLoop" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QEventLoop Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QEventLoop" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QEventLoop" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QEventLoop Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QEventLoop" ); + #endif } } +void * gcAllocate_QEventLoop( void * pObj ) +{ + QGC_POINTER_QEventLoop * p = ( QGC_POINTER_QEventLoop * ) hb_gcAllocate( sizeof( QGC_POINTER_QEventLoop ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QEventLoop; + new( & p->pq ) QPointer< QEventLoop >( ( QEventLoop * ) pObj ); + #if defined(__debug__) + just_debug( " new_QEventLoop %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QEVENTLOOP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QEventLoop > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QEventLoop %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QEventLoop( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QEventLoop; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QEventLoop( pObj ) ); } /* * int exec ( ProcessEventsFlags flags = AllEvents ) diff --git a/harbour/contrib/hbqt/qtcore/QFile.cpp b/harbour/contrib/hbqt/qtcore/QFile.cpp index 42a468acf9..61841025a1 100644 --- a/harbour/contrib/hbqt/qtcore/QFile.cpp +++ b/harbour/contrib/hbqt/qtcore/QFile.cpp @@ -86,55 +86,72 @@ * ~QFile () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFile > pq; +} QGC_POINTER_QFile; + QT_G_FUNC( release_QFile ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFile %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFile * p = ( QGC_POINTER_QFile * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFile p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFile ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFile * ) ph )->~QFile(); - ph = NULL; + ( ( QFile * ) p->ph )->~QFile(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFile Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFile %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFile" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFile Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFile" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFile" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFile Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFile" ); + #endif } } +void * gcAllocate_QFile( void * pObj ) +{ + QGC_POINTER_QFile * p = ( QGC_POINTER_QFile * ) hb_gcAllocate( sizeof( QGC_POINTER_QFile ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFile; + new( & p->pq ) QPointer< QFile >( ( QFile * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFile %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFILE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFile > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFile %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) { pObj = new QFile( hbqt_par_QString( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFile; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFile( pObj ) ); } /* * virtual bool atEnd () const @@ -341,7 +358,7 @@ HB_FUNC( QT_QFILE_DECODENAME_1 ) */ HB_FUNC( QT_QFILE_ENCODENAME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QFile( 1 )->encodeName( hbqt_par_QString( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QFile( 1 )->encodeName( hbqt_par_QString( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QFileInfo.cpp b/harbour/contrib/hbqt/qtcore/QFileInfo.cpp index 5606ec96e1..4faf572ebc 100644 --- a/harbour/contrib/hbqt/qtcore/QFileInfo.cpp +++ b/harbour/contrib/hbqt/qtcore/QFileInfo.cpp @@ -87,47 +87,55 @@ QT_G_FUNC( release_QFileInfo ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFileInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFileInfo p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QFileInfo ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QFileInfo * ) ph )->~QFileInfo(); - ph = NULL; + ( ( QFileInfo * ) p->ph )->~QFileInfo(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFileInfo Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFileInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFileInfo" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFileInfo Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFileInfo" ); + #endif } } +void * gcAllocate_QFileInfo( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFileInfo; + #if defined(__debug__) + just_debug( " new_QFileInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFILEINFO ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFileInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QFileInfo() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFileInfo; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFileInfo( pObj ) ); } /* * QDir absoluteDir () const */ HB_FUNC( QT_QFILEINFO_ABSOLUTEDIR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDir( hbqt_par_QFileInfo( 1 )->absoluteDir() ), release_QDir ) ); + hb_retptrGC( gcAllocate_QDir( new QDir( hbqt_par_QFileInfo( 1 )->absoluteDir() ) ) ); } /* @@ -207,7 +215,7 @@ HB_FUNC( QT_QFILEINFO_COMPLETESUFFIX ) */ HB_FUNC( QT_QFILEINFO_CREATED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QFileInfo( 1 )->created() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->created() ) ) ); } /* @@ -215,7 +223,7 @@ HB_FUNC( QT_QFILEINFO_CREATED ) */ HB_FUNC( QT_QFILEINFO_DIR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDir( hbqt_par_QFileInfo( 1 )->dir() ), release_QDir ) ); + hb_retptrGC( gcAllocate_QDir( new QDir( hbqt_par_QFileInfo( 1 )->dir() ) ) ); } /* @@ -351,7 +359,7 @@ HB_FUNC( QT_QFILEINFO_ISWRITABLE ) */ HB_FUNC( QT_QFILEINFO_LASTMODIFIED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QFileInfo( 1 )->lastModified() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->lastModified() ) ) ); } /* @@ -359,7 +367,7 @@ HB_FUNC( QT_QFILEINFO_LASTMODIFIED ) */ HB_FUNC( QT_QFILEINFO_LASTREAD ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QFileInfo( 1 )->lastRead() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->lastRead() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QIODevice.cpp b/harbour/contrib/hbqt/qtcore/QIODevice.cpp index bac35775f9..754b836d9c 100644 --- a/harbour/contrib/hbqt/qtcore/QIODevice.cpp +++ b/harbour/contrib/hbqt/qtcore/QIODevice.cpp @@ -84,31 +84,7 @@ QT_G_FUNC( release_QIODevice ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QIODevice %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QIODevice * ) ph )->~QIODevice(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QIODevice" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QIODevice" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QIODEVICE ) @@ -239,7 +215,7 @@ HB_FUNC( QT_QIODEVICE_PEEK ) */ HB_FUNC( QT_QIODEVICE_PEEK_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QIODevice( 1 )->peek( hb_parnint( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->peek( hb_parnint( 2 ) ) ) ) ); } /* @@ -271,7 +247,7 @@ HB_FUNC( QT_QIODEVICE_READ ) */ HB_FUNC( QT_QIODEVICE_READ_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QIODevice( 1 )->read( hb_parnint( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->read( hb_parnint( 2 ) ) ) ) ); } /* @@ -279,7 +255,7 @@ HB_FUNC( QT_QIODEVICE_READ_1 ) */ HB_FUNC( QT_QIODEVICE_READALL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QIODevice( 1 )->readAll() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->readAll() ) ) ); } /* @@ -295,7 +271,7 @@ HB_FUNC( QT_QIODEVICE_READLINE ) */ HB_FUNC( QT_QIODEVICE_READLINE_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QIODevice( 1 )->readLine( hb_parnint( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->readLine( hb_parnint( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QLatin1Char.cpp b/harbour/contrib/hbqt/qtcore/QLatin1Char.cpp index aeb04a94f4..9b0325e2bc 100644 --- a/harbour/contrib/hbqt/qtcore/QLatin1Char.cpp +++ b/harbour/contrib/hbqt/qtcore/QLatin1Char.cpp @@ -77,40 +77,48 @@ QT_G_FUNC( release_QLatin1Char ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLatin1Char %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLatin1Char p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QLatin1Char ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QLatin1Char * ) ph )->~QLatin1Char(); - ph = NULL; + ( ( QLatin1Char * ) p->ph )->~QLatin1Char(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLatin1Char Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLatin1Char %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLatin1Char" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLatin1Char Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLatin1Char" ); + #endif } } +void * gcAllocate_QLatin1Char( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLatin1Char; + #if defined(__debug__) + just_debug( " new_QLatin1Char %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLATIN1CHAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLatin1Char %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QLatin1Char* ) new QLatin1Char( *hb_parcx( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLatin1Char; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLatin1Char( pObj ) ); } /* * char toLatin1 () const diff --git a/harbour/contrib/hbqt/qtcore/QLatin1String.cpp b/harbour/contrib/hbqt/qtcore/QLatin1String.cpp index 73908fcaec..ed977c8e4a 100644 --- a/harbour/contrib/hbqt/qtcore/QLatin1String.cpp +++ b/harbour/contrib/hbqt/qtcore/QLatin1String.cpp @@ -77,40 +77,48 @@ QT_G_FUNC( release_QLatin1String ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLatin1String %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLatin1String p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QLatin1String ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QLatin1String * ) ph )->~QLatin1String(); - ph = NULL; + ( ( QLatin1String * ) p->ph )->~QLatin1String(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLatin1String Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLatin1String %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLatin1String" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLatin1String Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLatin1String" ); + #endif } } +void * gcAllocate_QLatin1String( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLatin1String; + #if defined(__debug__) + just_debug( " new_QLatin1String %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLATIN1STRING ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLatin1String %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QLatin1String* ) new QLatin1String( hb_parcx( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLatin1String; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLatin1String( pObj ) ); } /* * const char * latin1 () const diff --git a/harbour/contrib/hbqt/qtcore/QLine.cpp b/harbour/contrib/hbqt/qtcore/QLine.cpp index 0655d85d7a..5aedaf14d3 100644 --- a/harbour/contrib/hbqt/qtcore/QLine.cpp +++ b/harbour/contrib/hbqt/qtcore/QLine.cpp @@ -79,30 +79,44 @@ QT_G_FUNC( release_QLine ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLine p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QLine ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QLine * ) ph )->~QLine(); - ph = NULL; + ( ( QLine * ) p->ph )->~QLine(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLine Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLine" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLine Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLine" ); + #endif } } +void * gcAllocate_QLine( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLine; + #if defined(__debug__) + just_debug( " new_QLine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLINE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -121,20 +135,14 @@ hb_snprintf( str, sizeof(str), " GC: new QLine %i B %i pObj = ( QLine* ) new QLine() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLine; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLine( pObj ) ); } /* * QPoint p1 () const */ HB_FUNC( QT_QLINE_P1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QLine( 1 )->p1() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QLine( 1 )->p1() ) ) ); } /* @@ -142,7 +150,7 @@ HB_FUNC( QT_QLINE_P1 ) */ HB_FUNC( QT_QLINE_P2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QLine( 1 )->p2() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QLine( 1 )->p2() ) ) ); } /* @@ -254,7 +262,7 @@ HB_FUNC( QT_QLINE_TRANSLATE_1 ) */ HB_FUNC( QT_QLINE_TRANSLATED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLine( hbqt_par_QLine( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ), release_QLine ) ); + hb_retptrGC( gcAllocate_QLine( new QLine( hbqt_par_QLine( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -262,7 +270,7 @@ HB_FUNC( QT_QLINE_TRANSLATED ) */ HB_FUNC( QT_QLINE_TRANSLATED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLine( hbqt_par_QLine( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ), release_QLine ) ); + hb_retptrGC( gcAllocate_QLine( new QLine( hbqt_par_QLine( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QLineF.cpp b/harbour/contrib/hbqt/qtcore/QLineF.cpp index 5e4e4112a1..c6075b4391 100644 --- a/harbour/contrib/hbqt/qtcore/QLineF.cpp +++ b/harbour/contrib/hbqt/qtcore/QLineF.cpp @@ -83,47 +83,55 @@ QT_G_FUNC( release_QLineF ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLineF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLineF p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QLineF ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QLineF * ) ph )->~QLineF(); - ph = NULL; + ( ( QLineF * ) p->ph )->~QLineF(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLineF Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLineF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLineF" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLineF Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLineF" ); + #endif } } +void * gcAllocate_QLineF( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLineF; + #if defined(__debug__) + just_debug( " new_QLineF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLINEF ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLineF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QLineF() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLineF; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLineF( pObj ) ); } /* * QPointF p1 () const */ HB_FUNC( QT_QLINEF_P1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QLineF( 1 )->p1() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->p1() ) ) ); } /* @@ -131,7 +139,7 @@ HB_FUNC( QT_QLINEF_P1 ) */ HB_FUNC( QT_QLINEF_P2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QLineF( 1 )->p2() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->p2() ) ) ); } /* @@ -227,7 +235,7 @@ HB_FUNC( QT_QLINEF_LENGTH ) */ HB_FUNC( QT_QLINEF_NORMALVECTOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLineF( hbqt_par_QLineF( 1 )->normalVector() ), release_QLineF ) ); + hb_retptrGC( gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->normalVector() ) ) ); } /* @@ -235,7 +243,7 @@ HB_FUNC( QT_QLINEF_NORMALVECTOR ) */ HB_FUNC( QT_QLINEF_POINTAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QLineF( 1 )->pointAt( hb_parnd( 2 ) ) ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->pointAt( hb_parnd( 2 ) ) ) ) ); } /* @@ -291,7 +299,7 @@ HB_FUNC( QT_QLINEF_SETPOINTS ) */ HB_FUNC( QT_QLINEF_TOLINE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLine( hbqt_par_QLineF( 1 )->toLine() ), release_QLine ) ); + hb_retptrGC( gcAllocate_QLine( new QLine( hbqt_par_QLineF( 1 )->toLine() ) ) ); } /* @@ -315,7 +323,7 @@ HB_FUNC( QT_QLINEF_TRANSLATE_1 ) */ HB_FUNC( QT_QLINEF_TRANSLATED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLineF( hbqt_par_QLineF( 1 )->translated( *hbqt_par_QPointF( 2 ) ) ), release_QLineF ) ); + hb_retptrGC( gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->translated( *hbqt_par_QPointF( 2 ) ) ) ) ); } /* @@ -323,7 +331,7 @@ HB_FUNC( QT_QLINEF_TRANSLATED ) */ HB_FUNC( QT_QLINEF_TRANSLATED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLineF( hbqt_par_QLineF( 1 )->translated( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QLineF ) ); + hb_retptrGC( gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->translated( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* @@ -331,7 +339,7 @@ HB_FUNC( QT_QLINEF_TRANSLATED_1 ) */ HB_FUNC( QT_QLINEF_UNITVECTOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLineF( hbqt_par_QLineF( 1 )->unitVector() ), release_QLineF ) ); + hb_retptrGC( gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->unitVector() ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QList.cpp b/harbour/contrib/hbqt/qtcore/QList.cpp index 363b1fce59..4906132fbf 100644 --- a/harbour/contrib/hbqt/qtcore/QList.cpp +++ b/harbour/contrib/hbqt/qtcore/QList.cpp @@ -105,41 +105,49 @@ QT_G_FUNC( release_QList ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QList %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QList p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QList ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QList< void * > * ) ph )->~QList(); - ph = NULL; + ( ( QList< void * > * ) p->ph )->~QList(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QList Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QList %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QList" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QList Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QList" ); + #endif } } +void * gcAllocate_QList( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QList; + #if defined(__debug__) + just_debug( " new_QList %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLIST ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QList %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif QList* list = NULL; pObj = ( QList* ) list ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QList; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QList( pObj ) ); } /* * void append ( const T & value ) diff --git a/harbour/contrib/hbqt/qtcore/QLocale.cpp b/harbour/contrib/hbqt/qtcore/QLocale.cpp index a1a920b92a..b3a7b88d93 100644 --- a/harbour/contrib/hbqt/qtcore/QLocale.cpp +++ b/harbour/contrib/hbqt/qtcore/QLocale.cpp @@ -107,40 +107,48 @@ QT_G_FUNC( release_QLocale ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLocale %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLocale p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QLocale ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QLocale * ) ph )->~QLocale(); - ph = NULL; + ( ( QLocale * ) p->ph )->~QLocale(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLocale Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLocale %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLocale" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLocale Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLocale" ); + #endif } } +void * gcAllocate_QLocale( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLocale; + #if defined(__debug__) + just_debug( " new_QLocale %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLOCALE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLocale %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QLocale() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLocale; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLocale( pObj ) ); } /* * QString amText () const @@ -267,7 +275,7 @@ HB_FUNC( QT_QLOCALE_TIMEFORMAT ) */ HB_FUNC( QT_QLOCALE_TODATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QLocale( 1 )->toDate( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QLocale( 1 )->toDate( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ) ) ); } /* @@ -275,7 +283,7 @@ HB_FUNC( QT_QLOCALE_TODATE ) */ HB_FUNC( QT_QLOCALE_TODATE_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QLocale( 1 )->toDate( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QLocale( 1 )->toDate( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* @@ -283,7 +291,7 @@ HB_FUNC( QT_QLOCALE_TODATE_1 ) */ HB_FUNC( QT_QLOCALE_TODATETIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QLocale( 1 )->toDateTime( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QLocale( 1 )->toDateTime( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ) ) ); } /* @@ -291,7 +299,7 @@ HB_FUNC( QT_QLOCALE_TODATETIME ) */ HB_FUNC( QT_QLOCALE_TODATETIME_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QLocale( 1 )->toDateTime( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QLocale( 1 )->toDateTime( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* @@ -471,7 +479,7 @@ HB_FUNC( QT_QLOCALE_TOSTRING_13 ) */ HB_FUNC( QT_QLOCALE_TOTIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QLocale( 1 )->toTime( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QLocale( 1 )->toTime( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ) ) ); } /* @@ -479,7 +487,7 @@ HB_FUNC( QT_QLOCALE_TOTIME ) */ HB_FUNC( QT_QLOCALE_TOTIME_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QLocale( 1 )->toTime( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QLocale( 1 )->toTime( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* @@ -523,7 +531,7 @@ HB_FUNC( QT_QLOCALE_TOUSHORT ) */ HB_FUNC( QT_QLOCALE_C ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLocale( hbqt_par_QLocale( 1 )->c() ), release_QLocale ) ); + hb_retptrGC( gcAllocate_QLocale( new QLocale( hbqt_par_QLocale( 1 )->c() ) ) ); } /* @@ -555,7 +563,7 @@ HB_FUNC( QT_QLOCALE_SETDEFAULT ) */ HB_FUNC( QT_QLOCALE_SYSTEM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLocale( hbqt_par_QLocale( 1 )->system() ), release_QLocale ) ); + hb_retptrGC( gcAllocate_QLocale( new QLocale( hbqt_par_QLocale( 1 )->system() ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QMimeData.cpp b/harbour/contrib/hbqt/qtcore/QMimeData.cpp index 2195152acd..f0c921d653 100644 --- a/harbour/contrib/hbqt/qtcore/QMimeData.cpp +++ b/harbour/contrib/hbqt/qtcore/QMimeData.cpp @@ -86,52 +86,69 @@ * ~QMimeData () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QMimeData > pq; +} QGC_POINTER_QMimeData; + QT_G_FUNC( release_QMimeData ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMimeData %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QMimeData * p = ( QGC_POINTER_QMimeData * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QMimeData p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QMimeData ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QMimeData * ) ph )->~QMimeData(); - ph = NULL; + ( ( QMimeData * ) p->ph )->~QMimeData(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QMimeData Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QMimeData %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QMimeData" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMimeData Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QMimeData" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMimeData" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMimeData Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QMimeData" ); + #endif } } +void * gcAllocate_QMimeData( void * pObj ) +{ + QGC_POINTER_QMimeData * p = ( QGC_POINTER_QMimeData * ) hb_gcAllocate( sizeof( QGC_POINTER_QMimeData ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QMimeData; + new( & p->pq ) QPointer< QMimeData >( ( QMimeData * ) pObj ); + #if defined(__debug__) + just_debug( " new_QMimeData %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMIMEDATA ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QMimeData > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QMimeData %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QMimeData() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QMimeData; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QMimeData( pObj ) ); } /* * void clear () @@ -146,7 +163,7 @@ HB_FUNC( QT_QMIMEDATA_CLEAR ) */ HB_FUNC( QT_QMIMEDATA_COLORDATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QMimeData( 1 )->colorData() ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QMimeData( 1 )->colorData() ) ) ); } /* @@ -154,7 +171,7 @@ HB_FUNC( QT_QMIMEDATA_COLORDATA ) */ HB_FUNC( QT_QMIMEDATA_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QMimeData( 1 )->data( hbqt_par_QString( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QMimeData( 1 )->data( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -162,7 +179,7 @@ HB_FUNC( QT_QMIMEDATA_DATA ) */ HB_FUNC( QT_QMIMEDATA_FORMATS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QMimeData( 1 )->formats() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QMimeData( 1 )->formats() ) ) ); } /* @@ -226,7 +243,7 @@ HB_FUNC( QT_QMIMEDATA_HTML ) */ HB_FUNC( QT_QMIMEDATA_IMAGEDATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QMimeData( 1 )->imageData() ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QMimeData( 1 )->imageData() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QModelIndex.cpp b/harbour/contrib/hbqt/qtcore/QModelIndex.cpp index 442a93b064..e3e608c124 100644 --- a/harbour/contrib/hbqt/qtcore/QModelIndex.cpp +++ b/harbour/contrib/hbqt/qtcore/QModelIndex.cpp @@ -79,47 +79,55 @@ QT_G_FUNC( release_QModelIndex ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QModelIndex %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QModelIndex p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QModelIndex ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QModelIndex * ) ph )->~QModelIndex(); - ph = NULL; + ( ( QModelIndex * ) p->ph )->~QModelIndex(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QModelIndex Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QModelIndex %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QModelIndex" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QModelIndex Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QModelIndex" ); + #endif } } +void * gcAllocate_QModelIndex( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QModelIndex; + #if defined(__debug__) + just_debug( " new_QModelIndex %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMODELINDEX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QModelIndex %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QModelIndex() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QModelIndex; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QModelIndex( pObj ) ); } /* * QModelIndex child ( int row, int column ) const */ HB_FUNC( QT_QMODELINDEX_CHILD ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QModelIndex( 1 )->child( hb_parni( 2 ), hb_parni( 3 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->child( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -135,7 +143,7 @@ HB_FUNC( QT_QMODELINDEX_COLUMN ) */ HB_FUNC( QT_QMODELINDEX_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QModelIndex( 1 )->data( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::DisplayRole ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QModelIndex( 1 )->data( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::DisplayRole ) ) ) ) ); } /* @@ -183,7 +191,7 @@ HB_FUNC( QT_QMODELINDEX_MODEL ) */ HB_FUNC( QT_QMODELINDEX_PARENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QModelIndex( 1 )->parent() ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->parent() ) ) ); } /* @@ -199,7 +207,7 @@ HB_FUNC( QT_QMODELINDEX_ROW ) */ HB_FUNC( QT_QMODELINDEX_SIBLING ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QModelIndex( 1 )->sibling( hb_parni( 2 ), hb_parni( 3 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->sibling( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QObject.cpp b/harbour/contrib/hbqt/qtcore/QObject.cpp index 1cf7cf3263..bb055ee5a7 100644 --- a/harbour/contrib/hbqt/qtcore/QObject.cpp +++ b/harbour/contrib/hbqt/qtcore/QObject.cpp @@ -94,52 +94,69 @@ * virtual ~QObject () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QObject > pq; +} QGC_POINTER_QObject; + QT_G_FUNC( release_QObject ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QObject %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QObject * p = ( QGC_POINTER_QObject * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QObject p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QObject ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QObject * ) ph )->~QObject(); - ph = NULL; + ( ( QObject * ) p->ph )->~QObject(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QObject Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QObject %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QObject" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QObject Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QObject" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QObject" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QObject Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QObject" ); + #endif } } +void * gcAllocate_QObject( void * pObj ) +{ + QGC_POINTER_QObject * p = ( QGC_POINTER_QObject * ) hb_gcAllocate( sizeof( QGC_POINTER_QObject ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QObject; + new( & p->pq ) QPointer< QObject >( ( QObject * ) pObj ); + #if defined(__debug__) + just_debug( " new_QObject %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QOBJECT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QObject > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QObject %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QObject* ) new QObject( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QObject; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QObject( pObj ) ); } /* * bool blockSignals ( bool block ) @@ -274,7 +291,7 @@ HB_FUNC( QT_QOBJECT_PARENT ) */ HB_FUNC( QT_QOBJECT_PROPERTY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QObject( 1 )->property( hbqt_par_char( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QObject( 1 )->property( hbqt_par_char( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QPoint.cpp b/harbour/contrib/hbqt/qtcore/QPoint.cpp index 0c5240d7c8..2754cf246b 100644 --- a/harbour/contrib/hbqt/qtcore/QPoint.cpp +++ b/harbour/contrib/hbqt/qtcore/QPoint.cpp @@ -79,30 +79,44 @@ QT_G_FUNC( release_QPoint ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPoint %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPoint p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPoint ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPoint * ) ph )->~QPoint(); - ph = NULL; + ( ( QPoint * ) p->ph )->~QPoint(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPoint Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPoint %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPoint" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPoint Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPoint" ); + #endif } } +void * gcAllocate_QPoint( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPoint; + #if defined(__debug__) + just_debug( " new_QPoint %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPOINT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPoint %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 2 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) ) { @@ -117,13 +131,7 @@ hb_snprintf( str, sizeof(str), " GC: new QPoint %i B %i pObj = ( QPoint* ) new QPoint() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPoint; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPoint( pObj ) ); } /* * bool isNull () const diff --git a/harbour/contrib/hbqt/qtcore/QPointF.cpp b/harbour/contrib/hbqt/qtcore/QPointF.cpp index 5c50af87ed..d858efbbd2 100644 --- a/harbour/contrib/hbqt/qtcore/QPointF.cpp +++ b/harbour/contrib/hbqt/qtcore/QPointF.cpp @@ -79,30 +79,44 @@ QT_G_FUNC( release_QPointF ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPointF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPointF p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPointF ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPointF * ) ph )->~QPointF(); - ph = NULL; + ( ( QPointF * ) p->ph )->~QPointF(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPointF Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPointF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPointF" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPointF Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPointF" ); + #endif } } +void * gcAllocate_QPointF( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPointF; + #if defined(__debug__) + just_debug( " new_QPointF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPOINTF ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPointF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 2 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) ) { @@ -117,13 +131,7 @@ hb_snprintf( str, sizeof(str), " GC: new QPointF %i B %i pObj = ( QPointF* ) new QPointF() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPointF; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPointF( pObj ) ); } /* * bool isNull () const @@ -170,7 +178,7 @@ HB_FUNC( QT_QPOINTF_SETY ) */ HB_FUNC( QT_QPOINTF_TOPOINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QPointF( 1 )->toPoint() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QPointF( 1 )->toPoint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QProcess.cpp b/harbour/contrib/hbqt/qtcore/QProcess.cpp index 689077fd5b..a38aef42ec 100644 --- a/harbour/contrib/hbqt/qtcore/QProcess.cpp +++ b/harbour/contrib/hbqt/qtcore/QProcess.cpp @@ -87,42 +87,65 @@ * virtual ~QProcess () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QProcess > pq; +} QGC_POINTER_QProcess; + QT_G_FUNC( release_QProcess ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QProcess %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QProcess * p = ( QGC_POINTER_QProcess * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QProcess p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QProcess ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QProcess * ) ph )->~QProcess(); - ph = NULL; + ( ( QProcess * ) p->ph )->~QProcess(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QProcess Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QProcess %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QProcess" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QProcess Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QProcess" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QProcess" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QProcess Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QProcess" ); + #endif } } +void * gcAllocate_QProcess( void * pObj ) +{ + QGC_POINTER_QProcess * p = ( QGC_POINTER_QProcess * ) hb_gcAllocate( sizeof( QGC_POINTER_QProcess ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QProcess; + new( & p->pq ) QPointer< QProcess >( ( QProcess * ) pObj ); + #if defined(__debug__) + just_debug( " new_QProcess %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPROCESS ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QProcess > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QProcess %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -133,13 +156,7 @@ hb_snprintf( str, sizeof(str), " GC: new QProcess %i B %i pObj = ( QProcess* ) new QProcess() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QProcess; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QProcess( pObj ) ); } /* * virtual void close () @@ -170,7 +187,7 @@ HB_FUNC( QT_QPROCESS_CLOSEWRITECHANNEL ) */ HB_FUNC( QT_QPROCESS_ENVIRONMENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QProcess( 1 )->environment() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QProcess( 1 )->environment() ) ) ); } /* @@ -210,7 +227,7 @@ HB_FUNC( QT_QPROCESS_PROCESSCHANNELMODE ) */ HB_FUNC( QT_QPROCESS_READALLSTANDARDERROR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QProcess( 1 )->readAllStandardError() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QProcess( 1 )->readAllStandardError() ) ) ); } /* @@ -218,7 +235,7 @@ HB_FUNC( QT_QPROCESS_READALLSTANDARDERROR ) */ HB_FUNC( QT_QPROCESS_READALLSTANDARDOUTPUT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QProcess( 1 )->readAllStandardOutput() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QProcess( 1 )->readAllStandardOutput() ) ) ); } /* @@ -390,7 +407,7 @@ HB_FUNC( QT_QPROCESS_STARTDETACHED_2 ) */ HB_FUNC( QT_QPROCESS_SYSTEMENVIRONMENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QProcess( 1 )->systemEnvironment() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QProcess( 1 )->systemEnvironment() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QRect.cpp b/harbour/contrib/hbqt/qtcore/QRect.cpp index 28c2f12fff..aa0ce275ce 100644 --- a/harbour/contrib/hbqt/qtcore/QRect.cpp +++ b/harbour/contrib/hbqt/qtcore/QRect.cpp @@ -81,30 +81,44 @@ QT_G_FUNC( release_QRect ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QRect %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QRect p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QRect ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QRect * ) ph )->~QRect(); - ph = NULL; + ( ( QRect * ) p->ph )->~QRect(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QRect Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QRect %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QRect" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QRect Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QRect" ); + #endif } } +void * gcAllocate_QRect( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QRect; + #if defined(__debug__) + just_debug( " new_QRect %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QRECT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QRect %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -123,13 +137,7 @@ hb_snprintf( str, sizeof(str), " GC: new QRect %i B %i pObj = ( QRect* ) new QRect() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QRect; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QRect( pObj ) ); } /* * void adjust ( int dx1, int dy1, int dx2, int dy2 ) @@ -144,7 +152,7 @@ HB_FUNC( QT_QRECT_ADJUST ) */ HB_FUNC( QT_QRECT_ADJUSTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRect( 1 )->adjusted( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->adjusted( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ) ) ); } /* @@ -160,7 +168,7 @@ HB_FUNC( QT_QRECT_BOTTOM ) */ HB_FUNC( QT_QRECT_BOTTOMLEFT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QRect( 1 )->bottomLeft() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->bottomLeft() ) ) ); } /* @@ -168,7 +176,7 @@ HB_FUNC( QT_QRECT_BOTTOMLEFT ) */ HB_FUNC( QT_QRECT_BOTTOMRIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QRect( 1 )->bottomRight() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->bottomRight() ) ) ); } /* @@ -176,7 +184,7 @@ HB_FUNC( QT_QRECT_BOTTOMRIGHT ) */ HB_FUNC( QT_QRECT_CENTER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QRect( 1 )->center() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->center() ) ) ); } /* @@ -260,7 +268,7 @@ HB_FUNC( QT_QRECT_HEIGHT ) */ HB_FUNC( QT_QRECT_INTERSECTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRect( 1 )->intersected( *hbqt_par_QRect( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->intersected( *hbqt_par_QRect( 2 ) ) ) ) ); } /* @@ -396,7 +404,7 @@ HB_FUNC( QT_QRECT_MOVETOPRIGHT ) */ HB_FUNC( QT_QRECT_NORMALIZED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRect( 1 )->normalized() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->normalized() ) ) ); } /* @@ -532,7 +540,7 @@ HB_FUNC( QT_QRECT_SETY ) */ HB_FUNC( QT_QRECT_SIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QRect( 1 )->size() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QRect( 1 )->size() ) ) ); } /* @@ -548,7 +556,7 @@ HB_FUNC( QT_QRECT_TOP ) */ HB_FUNC( QT_QRECT_TOPLEFT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QRect( 1 )->topLeft() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->topLeft() ) ) ); } /* @@ -556,7 +564,7 @@ HB_FUNC( QT_QRECT_TOPLEFT ) */ HB_FUNC( QT_QRECT_TOPRIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QRect( 1 )->topRight() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->topRight() ) ) ); } /* @@ -580,7 +588,7 @@ HB_FUNC( QT_QRECT_TRANSLATE_1 ) */ HB_FUNC( QT_QRECT_TRANSLATED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRect( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -588,7 +596,7 @@ HB_FUNC( QT_QRECT_TRANSLATED ) */ HB_FUNC( QT_QRECT_TRANSLATED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRect( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -596,7 +604,7 @@ HB_FUNC( QT_QRECT_TRANSLATED_1 ) */ HB_FUNC( QT_QRECT_UNITED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRect( 1 )->united( *hbqt_par_QRect( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->united( *hbqt_par_QRect( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QRectF.cpp b/harbour/contrib/hbqt/qtcore/QRectF.cpp index 7f5e3fb41d..b4b43b6550 100644 --- a/harbour/contrib/hbqt/qtcore/QRectF.cpp +++ b/harbour/contrib/hbqt/qtcore/QRectF.cpp @@ -82,30 +82,44 @@ QT_G_FUNC( release_QRectF ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QRectF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QRectF p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QRectF ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QRectF * ) ph )->~QRectF(); - ph = NULL; + ( ( QRectF * ) p->ph )->~QRectF(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QRectF Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QRectF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QRectF" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QRectF Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QRectF" ); + #endif } } +void * gcAllocate_QRectF( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QRectF; + #if defined(__debug__) + just_debug( " new_QRectF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QRECTF ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QRectF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -124,13 +138,7 @@ hb_snprintf( str, sizeof(str), " GC: new QRectF %i B %i pObj = ( QRectF* ) new QRectF() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QRectF; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QRectF( pObj ) ); } /* * void adjust ( qreal dx1, qreal dy1, qreal dx2, qreal dy2 ) @@ -145,7 +153,7 @@ HB_FUNC( QT_QRECTF_ADJUST ) */ HB_FUNC( QT_QRECTF_ADJUSTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QRectF( 1 )->adjusted( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->adjusted( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ) ) ); } /* @@ -161,7 +169,7 @@ HB_FUNC( QT_QRECTF_BOTTOM ) */ HB_FUNC( QT_QRECTF_BOTTOMLEFT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QRectF( 1 )->bottomLeft() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->bottomLeft() ) ) ); } /* @@ -169,7 +177,7 @@ HB_FUNC( QT_QRECTF_BOTTOMLEFT ) */ HB_FUNC( QT_QRECTF_BOTTOMRIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QRectF( 1 )->bottomRight() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->bottomRight() ) ) ); } /* @@ -177,7 +185,7 @@ HB_FUNC( QT_QRECTF_BOTTOMRIGHT ) */ HB_FUNC( QT_QRECTF_CENTER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QRectF( 1 )->center() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->center() ) ) ); } /* @@ -253,7 +261,7 @@ HB_FUNC( QT_QRECTF_HEIGHT ) */ HB_FUNC( QT_QRECTF_INTERSECTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QRectF( 1 )->intersected( *hbqt_par_QRectF( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->intersected( *hbqt_par_QRectF( 2 ) ) ) ) ); } /* @@ -389,7 +397,7 @@ HB_FUNC( QT_QRECTF_MOVETOPRIGHT ) */ HB_FUNC( QT_QRECTF_NORMALIZED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QRectF( 1 )->normalized() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->normalized() ) ) ); } /* @@ -525,7 +533,7 @@ HB_FUNC( QT_QRECTF_SETY ) */ HB_FUNC( QT_QRECTF_SIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QRectF( 1 )->size() ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QRectF( 1 )->size() ) ) ); } /* @@ -533,7 +541,7 @@ HB_FUNC( QT_QRECTF_SIZE ) */ HB_FUNC( QT_QRECTF_TOALIGNEDRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRectF( 1 )->toAlignedRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRectF( 1 )->toAlignedRect() ) ) ); } /* @@ -541,7 +549,7 @@ HB_FUNC( QT_QRECTF_TOALIGNEDRECT ) */ HB_FUNC( QT_QRECTF_TORECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRectF( 1 )->toRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRectF( 1 )->toRect() ) ) ); } /* @@ -557,7 +565,7 @@ HB_FUNC( QT_QRECTF_TOP ) */ HB_FUNC( QT_QRECTF_TOPLEFT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QRectF( 1 )->topLeft() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->topLeft() ) ) ); } /* @@ -565,7 +573,7 @@ HB_FUNC( QT_QRECTF_TOPLEFT ) */ HB_FUNC( QT_QRECTF_TOPRIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QRectF( 1 )->topRight() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->topRight() ) ) ); } /* @@ -589,7 +597,7 @@ HB_FUNC( QT_QRECTF_TRANSLATE_1 ) */ HB_FUNC( QT_QRECTF_TRANSLATED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QRectF( 1 )->translated( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->translated( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* @@ -597,7 +605,7 @@ HB_FUNC( QT_QRECTF_TRANSLATED ) */ HB_FUNC( QT_QRECTF_TRANSLATED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QRectF( 1 )->translated( *hbqt_par_QPointF( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->translated( *hbqt_par_QPointF( 2 ) ) ) ) ); } /* @@ -605,7 +613,7 @@ HB_FUNC( QT_QRECTF_TRANSLATED_1 ) */ HB_FUNC( QT_QRECTF_UNITED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QRectF( 1 )->united( *hbqt_par_QRectF( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->united( *hbqt_par_QRectF( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QRegExp.cpp b/harbour/contrib/hbqt/qtcore/QRegExp.cpp index 0027280cd2..9847711180 100644 --- a/harbour/contrib/hbqt/qtcore/QRegExp.cpp +++ b/harbour/contrib/hbqt/qtcore/QRegExp.cpp @@ -84,40 +84,48 @@ QT_G_FUNC( release_QRegExp ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QRegExp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QRegExp p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QRegExp ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QRegExp * ) ph )->~QRegExp(); - ph = NULL; + ( ( QRegExp * ) p->ph )->~QRegExp(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QRegExp Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QRegExp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QRegExp" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QRegExp Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QRegExp" ); + #endif } } +void * gcAllocate_QRegExp( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QRegExp; + #if defined(__debug__) + just_debug( " new_QRegExp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QREGEXP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QRegExp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QRegExp() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QRegExp; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QRegExp( pObj ) ); } /* * QString cap ( int nth = 0 ) const @@ -132,7 +140,7 @@ HB_FUNC( QT_QREGEXP_CAP ) */ HB_FUNC( QT_QREGEXP_CAPTUREDTEXTS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QRegExp( 1 )->capturedTexts() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QRegExp( 1 )->capturedTexts() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QResource.cpp b/harbour/contrib/hbqt/qtcore/QResource.cpp index 19f80a5585..c26c300c7a 100644 --- a/harbour/contrib/hbqt/qtcore/QResource.cpp +++ b/harbour/contrib/hbqt/qtcore/QResource.cpp @@ -78,40 +78,48 @@ QT_G_FUNC( release_QResource ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QResource %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QResource p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QResource ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QResource * ) ph )->~QResource(); - ph = NULL; + ( ( QResource * ) p->ph )->~QResource(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QResource Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QResource %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QResource" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QResource Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QResource" ); + #endif } } +void * gcAllocate_QResource( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QResource; + #if defined(__debug__) + just_debug( " new_QResource %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QRESOURCE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QResource %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QResource* ) new QResource() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QResource; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QResource( pObj ) ); } /* * QString absoluteFilePath () const @@ -158,7 +166,7 @@ HB_FUNC( QT_QRESOURCE_ISVALID ) */ HB_FUNC( QT_QRESOURCE_LOCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLocale( hbqt_par_QResource( 1 )->locale() ), release_QLocale ) ); + hb_retptrGC( gcAllocate_QLocale( new QLocale( hbqt_par_QResource( 1 )->locale() ) ) ); } /* @@ -198,7 +206,7 @@ HB_FUNC( QT_QRESOURCE_REGISTERRESOURCE ) */ HB_FUNC( QT_QRESOURCE_SEARCHPATHS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QResource( 1 )->searchPaths() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QResource( 1 )->searchPaths() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QSignalMapper.cpp b/harbour/contrib/hbqt/qtcore/QSignalMapper.cpp index b6fc142cfa..b97140c578 100644 --- a/harbour/contrib/hbqt/qtcore/QSignalMapper.cpp +++ b/harbour/contrib/hbqt/qtcore/QSignalMapper.cpp @@ -76,52 +76,69 @@ * ~QSignalMapper () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSignalMapper > pq; +} QGC_POINTER_QSignalMapper; + QT_G_FUNC( release_QSignalMapper ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSignalMapper %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QSignalMapper * p = ( QGC_POINTER_QSignalMapper * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSignalMapper p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QSignalMapper ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QSignalMapper * ) ph )->~QSignalMapper(); - ph = NULL; + ( ( QSignalMapper * ) p->ph )->~QSignalMapper(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSignalMapper Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSignalMapper %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QSignalMapper" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSignalMapper Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QSignalMapper" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSignalMapper" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSignalMapper Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSignalMapper" ); + #endif } } +void * gcAllocate_QSignalMapper( void * pObj ) +{ + QGC_POINTER_QSignalMapper * p = ( QGC_POINTER_QSignalMapper * ) hb_gcAllocate( sizeof( QGC_POINTER_QSignalMapper ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSignalMapper; + new( & p->pq ) QPointer< QSignalMapper >( ( QSignalMapper * ) pObj ); + #if defined(__debug__) + just_debug( " new_QSignalMapper %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSIGNALMAPPER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QSignalMapper > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSignalMapper %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QSignalMapper( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSignalMapper; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSignalMapper( pObj ) ); } /* * QObject * mapping ( int id ) const diff --git a/harbour/contrib/hbqt/qtcore/QSize.cpp b/harbour/contrib/hbqt/qtcore/QSize.cpp index 7d7c105d39..140f99c0ec 100644 --- a/harbour/contrib/hbqt/qtcore/QSize.cpp +++ b/harbour/contrib/hbqt/qtcore/QSize.cpp @@ -79,30 +79,44 @@ QT_G_FUNC( release_QSize ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSize %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSize p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QSize ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QSize * ) ph )->~QSize(); - ph = NULL; + ( ( QSize * ) p->ph )->~QSize(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSize Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSize %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSize" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSize Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSize" ); + #endif } } +void * gcAllocate_QSize( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSize; + #if defined(__debug__) + just_debug( " new_QSize %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSIZE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSize %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 2 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) ) { @@ -117,13 +131,7 @@ hb_snprintf( str, sizeof(str), " GC: new QSize %i B %i pObj = ( QSize* ) new QSize() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSize; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSize( pObj ) ); } /* * int height () const @@ -226,7 +234,7 @@ HB_FUNC( QT_QSIZE_WIDTH ) */ HB_FUNC( QT_QSIZE_BOUNDEDTO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QSize( 1 )->boundedTo( *hbqt_par_QSize( 2 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QSize( 1 )->boundedTo( *hbqt_par_QSize( 2 ) ) ) ) ); } /* @@ -234,7 +242,7 @@ HB_FUNC( QT_QSIZE_BOUNDEDTO ) */ HB_FUNC( QT_QSIZE_EXPANDEDTO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QSize( 1 )->expandedTo( *hbqt_par_QSize( 2 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QSize( 1 )->expandedTo( *hbqt_par_QSize( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QSizeF.cpp b/harbour/contrib/hbqt/qtcore/QSizeF.cpp index aab0b9de3f..09920aeec9 100644 --- a/harbour/contrib/hbqt/qtcore/QSizeF.cpp +++ b/harbour/contrib/hbqt/qtcore/QSizeF.cpp @@ -80,30 +80,44 @@ QT_G_FUNC( release_QSizeF ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSizeF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeF p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeF ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QSizeF * ) ph )->~QSizeF(); - ph = NULL; + ( ( QSizeF * ) p->ph )->~QSizeF(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeF Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSizeF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSizeF" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeF Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSizeF" ); + #endif } } +void * gcAllocate_QSizeF( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSizeF; + #if defined(__debug__) + just_debug( " new_QSizeF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSIZEF ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSizeF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 2 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) ) { @@ -114,20 +128,14 @@ hb_snprintf( str, sizeof(str), " GC: new QSizeF %i B %i pObj = ( QSizeF* ) new QSizeF() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSizeF; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSizeF( pObj ) ); } /* * QSizeF boundedTo ( const QSizeF & otherSize ) const */ HB_FUNC( QT_QSIZEF_BOUNDEDTO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QSizeF( 1 )->boundedTo( *hbqt_par_QSizeF( 2 ) ) ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QSizeF( 1 )->boundedTo( *hbqt_par_QSizeF( 2 ) ) ) ) ); } /* @@ -135,7 +143,7 @@ HB_FUNC( QT_QSIZEF_BOUNDEDTO ) */ HB_FUNC( QT_QSIZEF_EXPANDEDTO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QSizeF( 1 )->expandedTo( *hbqt_par_QSizeF( 2 ) ) ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QSizeF( 1 )->expandedTo( *hbqt_par_QSizeF( 2 ) ) ) ) ); } /* @@ -223,7 +231,7 @@ HB_FUNC( QT_QSIZEF_SETWIDTH ) */ HB_FUNC( QT_QSIZEF_TOSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QSizeF( 1 )->toSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QSizeF( 1 )->toSize() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QStringList.cpp b/harbour/contrib/hbqt/qtcore/QStringList.cpp index 1333acaa05..0bc42043e9 100644 --- a/harbour/contrib/hbqt/qtcore/QStringList.cpp +++ b/harbour/contrib/hbqt/qtcore/QStringList.cpp @@ -98,40 +98,48 @@ QT_G_FUNC( release_QStringList ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStringList %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStringList p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStringList ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStringList * ) ph )->~QStringList(); - ph = NULL; + ( ( QStringList * ) p->ph )->~QStringList(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStringList Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStringList %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStringList" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStringList Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStringList" ); + #endif } } +void * gcAllocate_QStringList( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStringList; + #if defined(__debug__) + just_debug( " new_QStringList %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTRINGLIST ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStringList %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStringList* ) new QStringList() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStringList; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStringList( pObj ) ); } /* * void append ( const QString & value ) @@ -146,7 +154,7 @@ HB_FUNC( QT_QSTRINGLIST_APPEND ) */ HB_FUNC( QT_QSTRINGLIST_FILTER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QStringList( 1 )->filter( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::CaseSensitivity ) hb_parni( 3 ) : ( Qt::CaseSensitivity ) Qt::CaseSensitive ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QStringList( 1 )->filter( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::CaseSensitivity ) hb_parni( 3 ) : ( Qt::CaseSensitivity ) Qt::CaseSensitive ) ) ) ) ); } /* @@ -154,7 +162,7 @@ HB_FUNC( QT_QSTRINGLIST_FILTER ) */ HB_FUNC( QT_QSTRINGLIST_FILTER_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QStringList( 1 )->filter( *hbqt_par_QRegExp( 2 ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QStringList( 1 )->filter( *hbqt_par_QRegExp( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QTextBoundaryFinder.cpp b/harbour/contrib/hbqt/qtcore/QTextBoundaryFinder.cpp index 7e676fb667..81f29ecb39 100644 --- a/harbour/contrib/hbqt/qtcore/QTextBoundaryFinder.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextBoundaryFinder.cpp @@ -87,40 +87,48 @@ QT_G_FUNC( release_QTextBoundaryFinder ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextBoundaryFinder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBoundaryFinder p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBoundaryFinder ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextBoundaryFinder * ) ph )->~QTextBoundaryFinder(); - ph = NULL; + ( ( QTextBoundaryFinder * ) p->ph )->~QTextBoundaryFinder(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBoundaryFinder Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextBoundaryFinder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextBoundaryFinder" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBoundaryFinder Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextBoundaryFinder" ); + #endif } } +void * gcAllocate_QTextBoundaryFinder( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextBoundaryFinder; + #if defined(__debug__) + just_debug( " new_QTextBoundaryFinder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTBOUNDARYFINDER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextBoundaryFinder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextBoundaryFinder* ) new QTextBoundaryFinder() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextBoundaryFinder; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextBoundaryFinder( pObj ) ); } /* * BoundaryReasons boundaryReasons () const diff --git a/harbour/contrib/hbqt/qtcore/QTextCodec.cpp b/harbour/contrib/hbqt/qtcore/QTextCodec.cpp index 0b06332b76..8c3578a7bc 100644 --- a/harbour/contrib/hbqt/qtcore/QTextCodec.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextCodec.cpp @@ -124,7 +124,7 @@ HB_FUNC( QT_QTEXTCODEC_CANENCODE_1 ) */ HB_FUNC( QT_QTEXTCODEC_FROMUNICODE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QTextCodec( 1 )->fromUnicode( hbqt_par_QString( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextCodec( 1 )->fromUnicode( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -156,7 +156,7 @@ HB_FUNC( QT_QTEXTCODEC_MIBENUM ) */ HB_FUNC( QT_QTEXTCODEC_NAME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QTextCodec( 1 )->name() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextCodec( 1 )->name() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QTextDecoder.cpp b/harbour/contrib/hbqt/qtcore/QTextDecoder.cpp index b4806e538b..56030e6d91 100644 --- a/harbour/contrib/hbqt/qtcore/QTextDecoder.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextDecoder.cpp @@ -78,40 +78,48 @@ QT_G_FUNC( release_QTextDecoder ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextDecoder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDecoder p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDecoder ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextDecoder * ) ph )->~QTextDecoder(); - ph = NULL; + ( ( QTextDecoder * ) p->ph )->~QTextDecoder(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDecoder Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextDecoder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextDecoder" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDecoder Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextDecoder" ); + #endif } } +void * gcAllocate_QTextDecoder( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextDecoder; + #if defined(__debug__) + just_debug( " new_QTextDecoder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTDECODER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextDecoder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextDecoder* ) new QTextDecoder( hbqt_par_QTextCodec( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextDecoder; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextDecoder( pObj ) ); } /* * QString toUnicode ( const char * chars, int len ) diff --git a/harbour/contrib/hbqt/qtcore/QTextEncoder.cpp b/harbour/contrib/hbqt/qtcore/QTextEncoder.cpp index 1353ee0874..aee33e7571 100644 --- a/harbour/contrib/hbqt/qtcore/QTextEncoder.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextEncoder.cpp @@ -78,47 +78,55 @@ QT_G_FUNC( release_QTextEncoder ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextEncoder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEncoder p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEncoder ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextEncoder * ) ph )->~QTextEncoder(); - ph = NULL; + ( ( QTextEncoder * ) p->ph )->~QTextEncoder(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEncoder Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextEncoder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextEncoder" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEncoder Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextEncoder" ); + #endif } } +void * gcAllocate_QTextEncoder( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextEncoder; + #if defined(__debug__) + just_debug( " new_QTextEncoder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTENCODER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextEncoder %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextEncoder* ) new QTextEncoder( hbqt_par_QTextCodec( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextEncoder; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextEncoder( pObj ) ); } /* * QByteArray fromUnicode ( const QString & str ) */ HB_FUNC( QT_QTEXTENCODER_FROMUNICODE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QTextEncoder( 1 )->fromUnicode( hbqt_par_QString( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextEncoder( 1 )->fromUnicode( hbqt_par_QString( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QTextStream.cpp b/harbour/contrib/hbqt/qtcore/QTextStream.cpp index 86648d8401..d2b41b0a10 100644 --- a/harbour/contrib/hbqt/qtcore/QTextStream.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextStream.cpp @@ -98,40 +98,48 @@ HB_FUNC( QT_QTEXTSTREAM_PADCHAR ) QT_G_FUNC( release_QTextStream ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextStream %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextStream p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextStream ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextStream * ) ph )->~QTextStream(); - ph = NULL; + ( ( QTextStream * ) p->ph )->~QTextStream(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextStream Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextStream %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextStream" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextStream Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextStream" ); + #endif } } +void * gcAllocate_QTextStream( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextStream; + #if defined(__debug__) + just_debug( " new_QTextStream %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTSTREAM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextStream %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QTextStream( hb_parcx( 1 ), ( QIODevice::OpenMode ) ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : QIODevice::ReadWrite ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextStream; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextStream( pObj ) ); } /* * bool atEnd () const @@ -210,7 +218,7 @@ HB_FUNC( QT_QTEXTSTREAM_INTEGERBASE ) */ HB_FUNC( QT_QTEXTSTREAM_LOCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLocale( hbqt_par_QTextStream( 1 )->locale() ), release_QLocale ) ); + hb_retptrGC( gcAllocate_QLocale( new QLocale( hbqt_par_QTextStream( 1 )->locale() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QThread.cpp b/harbour/contrib/hbqt/qtcore/QThread.cpp index 0134bc46e4..5405f4fde7 100644 --- a/harbour/contrib/hbqt/qtcore/QThread.cpp +++ b/harbour/contrib/hbqt/qtcore/QThread.cpp @@ -79,52 +79,69 @@ * ~QThread () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QThread > pq; +} QGC_POINTER_QThread; + QT_G_FUNC( release_QThread ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QThread %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QThread * p = ( QGC_POINTER_QThread * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QThread p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QThread ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QThread * ) ph )->~QThread(); - ph = NULL; + ( ( QThread * ) p->ph )->~QThread(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QThread Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QThread %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QThread" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QThread Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QThread" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QThread" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QThread Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QThread" ); + #endif } } +void * gcAllocate_QThread( void * pObj ) +{ + QGC_POINTER_QThread * p = ( QGC_POINTER_QThread * ) hb_gcAllocate( sizeof( QGC_POINTER_QThread ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QThread; + new( & p->pq ) QPointer< QThread >( ( QThread * ) pObj ); + #if defined(__debug__) + just_debug( " new_QThread %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTHREAD ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QThread > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QThread %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QThread() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QThread; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QThread( pObj ) ); } /* * void exit ( int returnCode = 0 ) diff --git a/harbour/contrib/hbqt/qtcore/QTime.cpp b/harbour/contrib/hbqt/qtcore/QTime.cpp index 1b5c287425..ce20a7ec75 100644 --- a/harbour/contrib/hbqt/qtcore/QTime.cpp +++ b/harbour/contrib/hbqt/qtcore/QTime.cpp @@ -77,47 +77,55 @@ QT_G_FUNC( release_QTime ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTime %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTime p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTime ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTime * ) ph )->~QTime(); - ph = NULL; + ( ( QTime * ) p->ph )->~QTime(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTime Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTime %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTime" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTime Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTime" ); + #endif } } +void * gcAllocate_QTime( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTime; + #if defined(__debug__) + just_debug( " new_QTime %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTIME ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTime %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QTime() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTime; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTime( pObj ) ); } /* * QTime addMSecs ( int ms ) const */ HB_FUNC( QT_QTIME_ADDMSECS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QTime( 1 )->addMSecs( hb_parni( 2 ) ) ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->addMSecs( hb_parni( 2 ) ) ) ) ); } /* @@ -125,7 +133,7 @@ HB_FUNC( QT_QTIME_ADDMSECS ) */ HB_FUNC( QT_QTIME_ADDSECS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QTime( 1 )->addSecs( hb_parni( 2 ) ) ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->addSecs( hb_parni( 2 ) ) ) ) ); } /* @@ -245,7 +253,7 @@ HB_FUNC( QT_QTIME_TOSTRING_1 ) */ HB_FUNC( QT_QTIME_CURRENTTIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QTime( 1 )->currentTime() ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->currentTime() ) ) ); } /* @@ -253,7 +261,7 @@ HB_FUNC( QT_QTIME_CURRENTTIME ) */ HB_FUNC( QT_QTIME_FROMSTRING ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QTime( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::DateFormat ) hb_parni( 3 ) : ( Qt::DateFormat ) Qt::TextDate ) ) ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::DateFormat ) hb_parni( 3 ) : ( Qt::DateFormat ) Qt::TextDate ) ) ) ) ); } /* @@ -261,7 +269,7 @@ HB_FUNC( QT_QTIME_FROMSTRING ) */ HB_FUNC( QT_QTIME_FROMSTRING_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QTime( 1 )->fromString( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->fromString( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QTimer.cpp b/harbour/contrib/hbqt/qtcore/QTimer.cpp index af52de57e2..c974820655 100644 --- a/harbour/contrib/hbqt/qtcore/QTimer.cpp +++ b/harbour/contrib/hbqt/qtcore/QTimer.cpp @@ -76,52 +76,69 @@ * ~QTimer () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTimer > pq; +} QGC_POINTER_QTimer; + QT_G_FUNC( release_QTimer ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTimer %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTimer * p = ( QGC_POINTER_QTimer * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTimer p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTimer ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTimer * ) ph )->~QTimer(); - ph = NULL; + ( ( QTimer * ) p->ph )->~QTimer(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTimer Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTimer %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTimer" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTimer Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTimer" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTimer" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTimer Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTimer" ); + #endif } } +void * gcAllocate_QTimer( void * pObj ) +{ + QGC_POINTER_QTimer * p = ( QGC_POINTER_QTimer * ) hb_gcAllocate( sizeof( QGC_POINTER_QTimer ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTimer; + new( & p->pq ) QPointer< QTimer >( ( QTimer * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTimer %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTIMER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTimer > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTimer %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QTimer( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTimer; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTimer( pObj ) ); } /* * int interval () const diff --git a/harbour/contrib/hbqt/qtcore/QTranslator.cpp b/harbour/contrib/hbqt/qtcore/QTranslator.cpp index f8a154e91b..e29ae3313f 100644 --- a/harbour/contrib/hbqt/qtcore/QTranslator.cpp +++ b/harbour/contrib/hbqt/qtcore/QTranslator.cpp @@ -75,52 +75,69 @@ * ~QTranslator () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTranslator > pq; +} QGC_POINTER_QTranslator; + QT_G_FUNC( release_QTranslator ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTranslator %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTranslator * p = ( QGC_POINTER_QTranslator * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTranslator p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTranslator ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTranslator * ) ph )->~QTranslator(); - ph = NULL; + ( ( QTranslator * ) p->ph )->~QTranslator(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTranslator Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTranslator %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTranslator" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTranslator Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTranslator" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTranslator" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTranslator Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTranslator" ); + #endif } } +void * gcAllocate_QTranslator( void * pObj ) +{ + QGC_POINTER_QTranslator * p = ( QGC_POINTER_QTranslator * ) hb_gcAllocate( sizeof( QGC_POINTER_QTranslator ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTranslator; + new( & p->pq ) QPointer< QTranslator >( ( QTranslator * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTranslator %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTRANSLATOR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTranslator > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTranslator %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QTranslator() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTranslator; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTranslator( pObj ) ); } /* * virtual bool isEmpty () const diff --git a/harbour/contrib/hbqt/qtcore/QUrl.cpp b/harbour/contrib/hbqt/qtcore/QUrl.cpp index d2c08a7b36..6f91b0c9f4 100644 --- a/harbour/contrib/hbqt/qtcore/QUrl.cpp +++ b/harbour/contrib/hbqt/qtcore/QUrl.cpp @@ -112,40 +112,48 @@ HB_FUNC( QT_QURL_SETQUERYDELIMITERS ) QT_G_FUNC( release_QUrl ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QUrl %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QUrl p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QUrl ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QUrl * ) ph )->~QUrl(); - ph = NULL; + ( ( QUrl * ) p->ph )->~QUrl(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QUrl Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QUrl %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QUrl" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QUrl Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QUrl" ); + #endif } } +void * gcAllocate_QUrl( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QUrl; + #if defined(__debug__) + just_debug( " new_QUrl %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QURL ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QUrl %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QUrl( hbqt_par_QString( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QUrl; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QUrl( pObj ) ); } /* * void addEncodedQueryItem ( const QByteArray & key, const QByteArray & value ) @@ -168,7 +176,7 @@ HB_FUNC( QT_QURL_ADDQUERYITEM ) */ HB_FUNC( QT_QURL_ALLQUERYITEMVALUES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QUrl( 1 )->allQueryItemValues( hbqt_par_QString( 2 ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QUrl( 1 )->allQueryItemValues( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -192,7 +200,7 @@ HB_FUNC( QT_QURL_CLEAR ) */ HB_FUNC( QT_QURL_ENCODEDFRAGMENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->encodedFragment() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedFragment() ) ) ); } /* @@ -200,7 +208,7 @@ HB_FUNC( QT_QURL_ENCODEDFRAGMENT ) */ HB_FUNC( QT_QURL_ENCODEDHOST ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->encodedHost() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedHost() ) ) ); } /* @@ -208,7 +216,7 @@ HB_FUNC( QT_QURL_ENCODEDHOST ) */ HB_FUNC( QT_QURL_ENCODEDPASSWORD ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->encodedPassword() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedPassword() ) ) ); } /* @@ -216,7 +224,7 @@ HB_FUNC( QT_QURL_ENCODEDPASSWORD ) */ HB_FUNC( QT_QURL_ENCODEDPATH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->encodedPath() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedPath() ) ) ); } /* @@ -224,7 +232,7 @@ HB_FUNC( QT_QURL_ENCODEDPATH ) */ HB_FUNC( QT_QURL_ENCODEDQUERY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->encodedQuery() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedQuery() ) ) ); } /* @@ -232,7 +240,7 @@ HB_FUNC( QT_QURL_ENCODEDQUERY ) */ HB_FUNC( QT_QURL_ENCODEDQUERYITEMVALUE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->encodedQueryItemValue( *hbqt_par_QByteArray( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedQueryItemValue( *hbqt_par_QByteArray( 2 ) ) ) ) ); } /* @@ -240,7 +248,7 @@ HB_FUNC( QT_QURL_ENCODEDQUERYITEMVALUE ) */ HB_FUNC( QT_QURL_ENCODEDUSERNAME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->encodedUserName() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedUserName() ) ) ); } /* @@ -424,7 +432,7 @@ HB_FUNC( QT_QURL_REMOVEQUERYITEM ) */ HB_FUNC( QT_QURL_RESOLVED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QUrl( 1 )->resolved( *hbqt_par_QUrl( 2 ) ) ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->resolved( *hbqt_par_QUrl( 2 ) ) ) ) ); } /* @@ -592,7 +600,7 @@ HB_FUNC( QT_QURL_SETUSERNAME ) */ HB_FUNC( QT_QURL_TOENCODED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->toEncoded( ( HB_ISNUM( 2 ) ? ( QUrl::FormattingOptions ) hb_parni( 2 ) : ( QUrl::FormattingOptions ) QUrl::None ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toEncoded( ( HB_ISNUM( 2 ) ? ( QUrl::FormattingOptions ) hb_parni( 2 ) : ( QUrl::FormattingOptions ) QUrl::None ) ) ) ) ); } /* @@ -640,7 +648,7 @@ HB_FUNC( QT_QURL_FROMACE ) */ HB_FUNC( QT_QURL_FROMENCODED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QUrl( 1 )->fromEncoded( *hbqt_par_QByteArray( 2 ) ) ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromEncoded( *hbqt_par_QByteArray( 2 ) ) ) ) ); } /* @@ -648,7 +656,7 @@ HB_FUNC( QT_QURL_FROMENCODED ) */ HB_FUNC( QT_QURL_FROMENCODED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QUrl( 1 )->fromEncoded( *hbqt_par_QByteArray( 2 ), ( QUrl::ParsingMode ) hb_parni( 3 ) ) ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromEncoded( *hbqt_par_QByteArray( 2 ), ( QUrl::ParsingMode ) hb_parni( 3 ) ) ) ) ); } /* @@ -656,7 +664,7 @@ HB_FUNC( QT_QURL_FROMENCODED_1 ) */ HB_FUNC( QT_QURL_FROMLOCALFILE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QUrl( 1 )->fromLocalFile( hbqt_par_QString( 2 ) ) ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromLocalFile( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -672,7 +680,7 @@ HB_FUNC( QT_QURL_FROMPERCENTENCODING ) */ HB_FUNC( QT_QURL_IDNWHITELIST ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QUrl( 1 )->idnWhitelist() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QUrl( 1 )->idnWhitelist() ) ) ); } /* @@ -688,7 +696,7 @@ HB_FUNC( QT_QURL_SETIDNWHITELIST ) */ HB_FUNC( QT_QURL_TOACE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->toAce( hbqt_par_QString( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toAce( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -696,7 +704,7 @@ HB_FUNC( QT_QURL_TOACE ) */ HB_FUNC( QT_QURL_TOPERCENTENCODING ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QUrl( 1 )->toPercentEncoding( hbqt_par_QString( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QByteArray( 3 ) : QByteArray() ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QByteArray( 4 ) : QByteArray() ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toPercentEncoding( hbqt_par_QString( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QByteArray( 3 ) : QByteArray() ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QByteArray( 4 ) : QByteArray() ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QVariant.cpp b/harbour/contrib/hbqt/qtcore/QVariant.cpp index 37f15a4e86..5ebe1aa31f 100644 --- a/harbour/contrib/hbqt/qtcore/QVariant.cpp +++ b/harbour/contrib/hbqt/qtcore/QVariant.cpp @@ -141,40 +141,48 @@ QVariant ( const QRegExp & regExp ) QT_G_FUNC( release_QVariant ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QVariant %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QVariant p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QVariant ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QVariant * ) ph )->~QVariant(); - ph = NULL; + ( ( QVariant * ) p->ph )->~QVariant(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QVariant Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QVariant %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QVariant" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QVariant Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QVariant" ); + #endif } } +void * gcAllocate_QVariant( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QVariant; + #if defined(__debug__) + just_debug( " new_QVariant %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QVARIANT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QVariant %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QVariant* ) new QVariant() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QVariant; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QVariant( pObj ) ); } /* * bool canConvert ( Type t ) const @@ -237,7 +245,7 @@ HB_FUNC( QT_QVARIANT_SETVALUE ) */ HB_FUNC( QT_QVARIANT_TOBITARRAY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBitArray( hbqt_par_QVariant( 1 )->toBitArray() ), release_QBitArray ) ); + hb_retptrGC( gcAllocate_QBitArray( new QBitArray( hbqt_par_QVariant( 1 )->toBitArray() ) ) ); } /* @@ -253,7 +261,7 @@ HB_FUNC( QT_QVARIANT_TOBOOL ) */ HB_FUNC( QT_QVARIANT_TOBYTEARRAY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QVariant( 1 )->toByteArray() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QVariant( 1 )->toByteArray() ) ) ); } /* @@ -261,7 +269,7 @@ HB_FUNC( QT_QVARIANT_TOBYTEARRAY ) */ HB_FUNC( QT_QVARIANT_TODATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QVariant( 1 )->toDate() ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QVariant( 1 )->toDate() ) ) ); } /* @@ -269,7 +277,7 @@ HB_FUNC( QT_QVARIANT_TODATE ) */ HB_FUNC( QT_QVARIANT_TODATETIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QVariant( 1 )->toDateTime() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QVariant( 1 )->toDateTime() ) ) ); } /* @@ -301,7 +309,7 @@ HB_FUNC( QT_QVARIANT_TOINT ) */ HB_FUNC( QT_QVARIANT_TOLINE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLine( hbqt_par_QVariant( 1 )->toLine() ), release_QLine ) ); + hb_retptrGC( gcAllocate_QLine( new QLine( hbqt_par_QVariant( 1 )->toLine() ) ) ); } /* @@ -309,7 +317,7 @@ HB_FUNC( QT_QVARIANT_TOLINE ) */ HB_FUNC( QT_QVARIANT_TOLINEF ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLineF( hbqt_par_QVariant( 1 )->toLineF() ), release_QLineF ) ); + hb_retptrGC( gcAllocate_QLineF( new QLineF( hbqt_par_QVariant( 1 )->toLineF() ) ) ); } /* @@ -317,7 +325,7 @@ HB_FUNC( QT_QVARIANT_TOLINEF ) */ HB_FUNC( QT_QVARIANT_TOLOCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLocale( hbqt_par_QVariant( 1 )->toLocale() ), release_QLocale ) ); + hb_retptrGC( gcAllocate_QLocale( new QLocale( hbqt_par_QVariant( 1 )->toLocale() ) ) ); } /* @@ -337,7 +345,7 @@ HB_FUNC( QT_QVARIANT_TOLONGLONG ) */ HB_FUNC( QT_QVARIANT_TOPOINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QVariant( 1 )->toPoint() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QVariant( 1 )->toPoint() ) ) ); } /* @@ -345,7 +353,7 @@ HB_FUNC( QT_QVARIANT_TOPOINT ) */ HB_FUNC( QT_QVARIANT_TOPOINTF ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QVariant( 1 )->toPointF() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QVariant( 1 )->toPointF() ) ) ); } /* @@ -353,7 +361,7 @@ HB_FUNC( QT_QVARIANT_TOPOINTF ) */ HB_FUNC( QT_QVARIANT_TORECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QVariant( 1 )->toRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QVariant( 1 )->toRect() ) ) ); } /* @@ -361,7 +369,7 @@ HB_FUNC( QT_QVARIANT_TORECT ) */ HB_FUNC( QT_QVARIANT_TORECTF ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QVariant( 1 )->toRectF() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QVariant( 1 )->toRectF() ) ) ); } /* @@ -369,7 +377,7 @@ HB_FUNC( QT_QVARIANT_TORECTF ) */ HB_FUNC( QT_QVARIANT_TOREGEXP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegExp( hbqt_par_QVariant( 1 )->toRegExp() ), release_QRegExp ) ); + hb_retptrGC( gcAllocate_QRegExp( new QRegExp( hbqt_par_QVariant( 1 )->toRegExp() ) ) ); } /* @@ -377,7 +385,7 @@ HB_FUNC( QT_QVARIANT_TOREGEXP ) */ HB_FUNC( QT_QVARIANT_TOSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QVariant( 1 )->toSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QVariant( 1 )->toSize() ) ) ); } /* @@ -385,7 +393,7 @@ HB_FUNC( QT_QVARIANT_TOSIZE ) */ HB_FUNC( QT_QVARIANT_TOSIZEF ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QVariant( 1 )->toSizeF() ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QVariant( 1 )->toSizeF() ) ) ); } /* @@ -401,7 +409,7 @@ HB_FUNC( QT_QVARIANT_TOSTRING ) */ HB_FUNC( QT_QVARIANT_TOSTRINGLIST ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QVariant( 1 )->toStringList() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QVariant( 1 )->toStringList() ) ) ); } /* @@ -409,7 +417,7 @@ HB_FUNC( QT_QVARIANT_TOSTRINGLIST ) */ HB_FUNC( QT_QVARIANT_TOTIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QVariant( 1 )->toTime() ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QVariant( 1 )->toTime() ) ) ); } /* @@ -441,7 +449,7 @@ HB_FUNC( QT_QVARIANT_TOULONGLONG ) */ HB_FUNC( QT_QVARIANT_TOURL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QVariant( 1 )->toUrl() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QVariant( 1 )->toUrl() ) ) ); } /* @@ -465,7 +473,7 @@ HB_FUNC( QT_QVARIANT_USERTYPE ) */ HB_FUNC( QT_QVARIANT_FROMVALUE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QVariant( 1 )->fromValue( hb_param( 2, HB_IT_ANY ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QVariant( 1 )->fromValue( hb_param( 2, HB_IT_ANY ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractButton.cpp b/harbour/contrib/hbqt/qtgui/QAbstractButton.cpp index aa89570803..182f81595a 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractButton.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QAbstractButton ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractButton * ) ph )->~QAbstractButton(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractButton" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractButton" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTBUTTON ) @@ -153,7 +129,7 @@ HB_FUNC( QT_QABSTRACTBUTTON_GROUP ) */ HB_FUNC( QT_QABSTRACTBUTTON_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QAbstractButton( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QAbstractButton( 1 )->icon() ) ) ); } /* @@ -161,7 +137,7 @@ HB_FUNC( QT_QABSTRACTBUTTON_ICON ) */ HB_FUNC( QT_QABSTRACTBUTTON_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QAbstractButton( 1 )->iconSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QAbstractButton( 1 )->iconSize() ) ) ); } /* @@ -265,7 +241,7 @@ HB_FUNC( QT_QABSTRACTBUTTON_SETTEXT ) */ HB_FUNC( QT_QABSTRACTBUTTON_SHORTCUT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QKeySequence( hbqt_par_QAbstractButton( 1 )->shortcut() ), release_QKeySequence ) ); + hb_retptrGC( gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QAbstractButton( 1 )->shortcut() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractItemDelegate.cpp b/harbour/contrib/hbqt/qtgui/QAbstractItemDelegate.cpp index 74b3e08d1a..1ea6318c02 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractItemDelegate.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractItemDelegate.cpp @@ -132,7 +132,7 @@ HB_FUNC( QT_QABSTRACTITEMDELEGATE_SETMODELDATA ) */ HB_FUNC( QT_QABSTRACTITEMDELEGATE_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QAbstractItemDelegate( 1 )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemDelegate( 1 )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractItemView.cpp b/harbour/contrib/hbqt/qtgui/QAbstractItemView.cpp index 5a6795d94a..4417e809e2 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractItemView.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractItemView.cpp @@ -88,31 +88,7 @@ QT_G_FUNC( release_QAbstractItemView ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractItemView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractItemView * ) ph )->~QAbstractItemView(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractItemView" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractItemView" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTITEMVIEW ) @@ -147,7 +123,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_CLOSEPERSISTENTEDITOR ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_CURRENTINDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->currentIndex() ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->currentIndex() ) ) ); } /* @@ -203,7 +179,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_HORIZONTALSCROLLMODE ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QAbstractItemView( 1 )->iconSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemView( 1 )->iconSize() ) ) ); } /* @@ -211,7 +187,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_ICONSIZE ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_INDEXAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -283,7 +259,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_OPENPERSISTENTEDITOR ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_ROOTINDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->rootIndex() ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->rootIndex() ) ) ); } /* @@ -507,7 +483,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_SIZEHINTFORCOLUMN ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_SIZEHINTFORINDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QAbstractItemView( 1 )->sizeHintForIndex( *hbqt_par_QModelIndex( 2 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemView( 1 )->sizeHintForIndex( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -547,7 +523,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_VERTICALSCROLLMODE ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_VISUALRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QAbstractItemView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QAbstractItemView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractPrintDialog.cpp b/harbour/contrib/hbqt/qtgui/QAbstractPrintDialog.cpp index 81e46dca09..389b33e63c 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractPrintDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractPrintDialog.cpp @@ -92,31 +92,7 @@ QT_G_FUNC( release_QAbstractPrintDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractPrintDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractPrintDialog * ) ph )->~QAbstractPrintDialog(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractPrintDialog" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractPrintDialog" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTPRINTDIALOG ) diff --git a/harbour/contrib/hbqt/qtgui/QAbstractProxyModel.cpp b/harbour/contrib/hbqt/qtgui/QAbstractProxyModel.cpp index ed59e555c9..14591cd810 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractProxyModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractProxyModel.cpp @@ -77,31 +77,7 @@ QT_G_FUNC( release_QAbstractProxyModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractProxyModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractProxyModel * ) ph )->~QAbstractProxyModel(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractProxyModel" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractProxyModel" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTPROXYMODEL ) @@ -112,7 +88,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPFROMSOURCE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractProxyModel( 1 )->mapFromSource( *hbqt_par_QModelIndex( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractProxyModel( 1 )->mapFromSource( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -120,7 +96,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPFROMSOURCE ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPSELECTIONFROMSOURCE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QItemSelection( hbqt_par_QAbstractProxyModel( 1 )->mapSelectionFromSource( *hbqt_par_QItemSelection( 2 ) ) ), release_QItemSelection ) ); + hb_retptrGC( gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QAbstractProxyModel( 1 )->mapSelectionFromSource( *hbqt_par_QItemSelection( 2 ) ) ) ) ); } /* @@ -128,7 +104,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPSELECTIONFROMSOURCE ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPSELECTIONTOSOURCE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QItemSelection( hbqt_par_QAbstractProxyModel( 1 )->mapSelectionToSource( *hbqt_par_QItemSelection( 2 ) ) ), release_QItemSelection ) ); + hb_retptrGC( gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QAbstractProxyModel( 1 )->mapSelectionToSource( *hbqt_par_QItemSelection( 2 ) ) ) ) ); } /* @@ -136,7 +112,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPSELECTIONTOSOURCE ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPTOSOURCE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QAbstractProxyModel( 1 )->mapToSource( *hbqt_par_QModelIndex( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractProxyModel( 1 )->mapToSource( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractScrollArea.cpp b/harbour/contrib/hbqt/qtgui/QAbstractScrollArea.cpp index 9a2b8e1fc6..6ad20bfd13 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractScrollArea.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractScrollArea.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QAbstractScrollArea ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractScrollArea %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractScrollArea * ) ph )->~QAbstractScrollArea(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractScrollArea" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractScrollArea" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTSCROLLAREA ) @@ -145,7 +121,7 @@ HB_FUNC( QT_QABSTRACTSCROLLAREA_HORIZONTALSCROLLBARPOLICY ) */ HB_FUNC( QT_QABSTRACTSCROLLAREA_MAXIMUMVIEWPORTSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QAbstractScrollArea( 1 )->maximumViewportSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QAbstractScrollArea( 1 )->maximumViewportSize() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractSlider.cpp b/harbour/contrib/hbqt/qtgui/QAbstractSlider.cpp index 833c76fedd..b14b2de565 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractSlider.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractSlider.cpp @@ -82,31 +82,7 @@ QT_G_FUNC( release_QAbstractSlider ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractSlider * ) ph )->~QAbstractSlider(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractSlider" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractSlider" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTSLIDER ) diff --git a/harbour/contrib/hbqt/qtgui/QAbstractSpinBox.cpp b/harbour/contrib/hbqt/qtgui/QAbstractSpinBox.cpp index 9ce98ce11d..0368bba329 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractSpinBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractSpinBox.cpp @@ -85,31 +85,7 @@ QT_G_FUNC( release_QAbstractSpinBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractSpinBox * ) ph )->~QAbstractSpinBox(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractSpinBox" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractSpinBox" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTSPINBOX ) diff --git a/harbour/contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp b/harbour/contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp index d9b2cb8a40..c3160602e7 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp @@ -77,31 +77,7 @@ QT_G_FUNC( release_QAbstractTextDocumentLayout ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAbstractTextDocumentLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QAbstractTextDocumentLayout * ) ph )->~QAbstractTextDocumentLayout(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAbstractTextDocumentLayout" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAbstractTextDocumentLayout" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT ) @@ -120,7 +96,7 @@ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_ANCHORAT ) */ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_BLOCKBOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QAbstractTextDocumentLayout( 1 )->blockBoundingRect( *hbqt_par_QTextBlock( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QAbstractTextDocumentLayout( 1 )->blockBoundingRect( *hbqt_par_QTextBlock( 2 ) ) ) ) ); } /* @@ -136,7 +112,7 @@ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_DOCUMENT ) */ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_DOCUMENTSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QAbstractTextDocumentLayout( 1 )->documentSize() ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QAbstractTextDocumentLayout( 1 )->documentSize() ) ) ); } /* @@ -144,7 +120,7 @@ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_DOCUMENTSIZE ) */ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_FRAMEBOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QAbstractTextDocumentLayout( 1 )->frameBoundingRect( hbqt_par_QTextFrame( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QAbstractTextDocumentLayout( 1 )->frameBoundingRect( hbqt_par_QTextFrame( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAction.cpp b/harbour/contrib/hbqt/qtgui/QAction.cpp index eb156001e1..9b9e8f5cc8 100644 --- a/harbour/contrib/hbqt/qtgui/QAction.cpp +++ b/harbour/contrib/hbqt/qtgui/QAction.cpp @@ -95,42 +95,65 @@ * ~QAction () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QAction > pq; +} QGC_POINTER_QAction; + QT_G_FUNC( release_QAction ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QAction %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QAction * p = ( QGC_POINTER_QAction * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QAction p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QAction ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QAction * ) ph )->~QAction(); - ph = NULL; + ( ( QAction * ) p->ph )->~QAction(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QAction Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QAction %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QAction" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QAction Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QAction" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QAction" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QAction Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QAction" ); + #endif } } +void * gcAllocate_QAction( void * pObj ) +{ + QGC_POINTER_QAction * p = ( QGC_POINTER_QAction * ) hb_gcAllocate( sizeof( QGC_POINTER_QAction ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QAction; + new( & p->pq ) QPointer< QAction >( ( QAction * ) pObj ); + #if defined(__debug__) + just_debug( " new_QAction %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QACTION ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QAction > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QAction %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( HB_ISPOINTER( 1 ) ) pObj = new QAction( hbqt_par_QObject( 1 ) ) ; @@ -139,13 +162,7 @@ hb_snprintf( str, sizeof(str), " GC: new QAction %i B %i else if( HB_ISPOINTER( 3 ) ) pObj = new QAction( *hbqt_par_QIcon( 1 ), hbqt_par_QString( 2 ), hbqt_par_QObject( 3 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QAction; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QAction( pObj ) ); } /* * QActionGroup * actionGroup () const @@ -176,7 +193,7 @@ HB_FUNC( QT_QACTION_AUTOREPEAT ) */ HB_FUNC( QT_QACTION_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QAction( 1 )->data() ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QAction( 1 )->data() ) ) ); } /* @@ -184,7 +201,7 @@ HB_FUNC( QT_QACTION_DATA ) */ HB_FUNC( QT_QACTION_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QAction( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QAction( 1 )->font() ) ) ); } /* @@ -192,7 +209,7 @@ HB_FUNC( QT_QACTION_FONT ) */ HB_FUNC( QT_QACTION_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QAction( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QAction( 1 )->icon() ) ) ); } /* @@ -424,7 +441,7 @@ HB_FUNC( QT_QACTION_SETWHATSTHIS ) */ HB_FUNC( QT_QACTION_SHORTCUT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QKeySequence( hbqt_par_QAction( 1 )->shortcut() ), release_QKeySequence ) ); + hb_retptrGC( gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QAction( 1 )->shortcut() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QActionGroup.cpp b/harbour/contrib/hbqt/qtgui/QActionGroup.cpp index 7e55567f18..604f6a541d 100644 --- a/harbour/contrib/hbqt/qtgui/QActionGroup.cpp +++ b/harbour/contrib/hbqt/qtgui/QActionGroup.cpp @@ -84,55 +84,72 @@ * ~QActionGroup () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QActionGroup > pq; +} QGC_POINTER_QActionGroup; + QT_G_FUNC( release_QActionGroup ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QActionGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QActionGroup * p = ( QGC_POINTER_QActionGroup * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QActionGroup p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QActionGroup ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QActionGroup * ) ph )->~QActionGroup(); - ph = NULL; + ( ( QActionGroup * ) p->ph )->~QActionGroup(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QActionGroup Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QActionGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QActionGroup" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QActionGroup Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QActionGroup" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QActionGroup" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QActionGroup Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QActionGroup" ); + #endif } } +void * gcAllocate_QActionGroup( void * pObj ) +{ + QGC_POINTER_QActionGroup * p = ( QGC_POINTER_QActionGroup * ) hb_gcAllocate( sizeof( QGC_POINTER_QActionGroup ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QActionGroup; + new( & p->pq ) QPointer< QActionGroup >( ( QActionGroup * ) pObj ); + #if defined(__debug__) + just_debug( " new_QActionGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QACTIONGROUP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QActionGroup > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QActionGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { pObj = new QActionGroup( hbqt_par_QObject( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QActionGroup; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QActionGroup( pObj ) ); } /* * QAction * addAction ( QAction * action ) diff --git a/harbour/contrib/hbqt/qtgui/QApplication.cpp b/harbour/contrib/hbqt/qtgui/QApplication.cpp index 9b74fd3091..0691579a8d 100644 --- a/harbour/contrib/hbqt/qtgui/QApplication.cpp +++ b/harbour/contrib/hbqt/qtgui/QApplication.cpp @@ -161,52 +161,69 @@ HB_FUNC( QT_QAPPLICATION_QUIT ) app->quit(); } +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QApplication > pq; +} QGC_POINTER_QApplication; + QT_G_FUNC( release_QApplication ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QApplication %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QApplication * p = ( QGC_POINTER_QApplication * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QApplication p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QApplication ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QApplication * ) ph )->~QApplication(); - ph = NULL; + ( ( QApplication * ) p->ph )->~QApplication(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QApplication Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QApplication %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QApplication" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QApplication Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QApplication" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QApplication" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QApplication Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QApplication" ); + #endif } } +void * gcAllocate_QApplication( void * pObj ) +{ + QGC_POINTER_QApplication * p = ( QGC_POINTER_QApplication * ) hb_gcAllocate( sizeof( QGC_POINTER_QApplication ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QApplication; + new( & p->pq ) QPointer< QApplication >( ( QApplication * ) pObj ); + #if defined(__debug__) + just_debug( " new_QApplication %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QAPPLICATION ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QApplication > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QApplication %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QApplication * ) app ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QApplication; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QApplication( pObj ) ); } /* * virtual void commitData ( QSessionManager & manager ) @@ -389,7 +406,7 @@ HB_FUNC( QT_QAPPLICATION_FOCUSWIDGET ) */ HB_FUNC( QT_QAPPLICATION_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QApplication( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font() ) ) ); } /* @@ -397,7 +414,7 @@ HB_FUNC( QT_QAPPLICATION_FONT ) */ HB_FUNC( QT_QAPPLICATION_FONT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QApplication( 1 )->font( hbqt_par_QWidget( 2 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font( hbqt_par_QWidget( 2 ) ) ) ) ); } /* @@ -405,7 +422,7 @@ HB_FUNC( QT_QAPPLICATION_FONT_1 ) */ HB_FUNC( QT_QAPPLICATION_FONT_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QApplication( 1 )->font( hbqt_par_char( 2 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font( hbqt_par_char( 2 ) ) ) ) ); } /* @@ -413,7 +430,7 @@ HB_FUNC( QT_QAPPLICATION_FONT_2 ) */ HB_FUNC( QT_QAPPLICATION_FONTMETRICS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFontMetrics( hbqt_par_QApplication( 1 )->fontMetrics() ), release_QFontMetrics ) ); + hb_retptrGC( gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QApplication( 1 )->fontMetrics() ) ) ); } /* @@ -421,7 +438,7 @@ HB_FUNC( QT_QAPPLICATION_FONTMETRICS ) */ HB_FUNC( QT_QAPPLICATION_GLOBALSTRUT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QApplication( 1 )->globalStrut() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QApplication( 1 )->globalStrut() ) ) ); } /* @@ -469,7 +486,7 @@ HB_FUNC( QT_QAPPLICATION_KEYBOARDINPUTINTERVAL ) */ HB_FUNC( QT_QAPPLICATION_KEYBOARDINPUTLOCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLocale( hbqt_par_QApplication( 1 )->keyboardInputLocale() ), release_QLocale ) ); + hb_retptrGC( gcAllocate_QLocale( new QLocale( hbqt_par_QApplication( 1 )->keyboardInputLocale() ) ) ); } /* @@ -509,7 +526,7 @@ HB_FUNC( QT_QAPPLICATION_OVERRIDECURSOR ) */ HB_FUNC( QT_QAPPLICATION_PALETTE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPalette( hbqt_par_QApplication( 1 )->palette() ), release_QPalette ) ); + hb_retptrGC( gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette() ) ) ); } /* @@ -517,7 +534,7 @@ HB_FUNC( QT_QAPPLICATION_PALETTE ) */ HB_FUNC( QT_QAPPLICATION_PALETTE_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPalette( hbqt_par_QApplication( 1 )->palette( hbqt_par_QWidget( 2 ) ) ), release_QPalette ) ); + hb_retptrGC( gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette( hbqt_par_QWidget( 2 ) ) ) ) ); } /* @@ -525,7 +542,7 @@ HB_FUNC( QT_QAPPLICATION_PALETTE_1 ) */ HB_FUNC( QT_QAPPLICATION_PALETTE_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPalette( hbqt_par_QApplication( 1 )->palette( hbqt_par_char( 2 ) ) ), release_QPalette ) ); + hb_retptrGC( gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette( hbqt_par_char( 2 ) ) ) ) ); } /* @@ -789,7 +806,7 @@ HB_FUNC( QT_QAPPLICATION_WIDGETAT_1 ) */ HB_FUNC( QT_QAPPLICATION_WINDOWICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QApplication( 1 )->windowIcon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QApplication( 1 )->windowIcon() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QBitmap.cpp b/harbour/contrib/hbqt/qtgui/QBitmap.cpp index fe9c4b4c87..d8fbc0bb97 100644 --- a/harbour/contrib/hbqt/qtgui/QBitmap.cpp +++ b/harbour/contrib/hbqt/qtgui/QBitmap.cpp @@ -82,30 +82,44 @@ QT_G_FUNC( release_QBitmap ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QBitmap %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QBitmap p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QBitmap ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QBitmap * ) ph )->~QBitmap(); - ph = NULL; + ( ( QBitmap * ) p->ph )->~QBitmap(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QBitmap Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QBitmap %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QBitmap" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QBitmap Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QBitmap" ); + #endif } } +void * gcAllocate_QBitmap( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QBitmap; + #if defined(__debug__) + just_debug( " new_QBitmap %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QBITMAP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QBitmap %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -143,13 +157,7 @@ hb_snprintf( str, sizeof(str), " GC: new QBitmap %i B %i pObj = ( QBitmap* ) new QBitmap() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QBitmap; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QBitmap( pObj ) ); } /* * void clear () @@ -164,7 +172,7 @@ HB_FUNC( QT_QBITMAP_CLEAR ) */ HB_FUNC( QT_QBITMAP_TRANSFORMED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QTransform( 2 ) ) ), release_QBitmap ) ); + hb_retptrGC( gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QTransform( 2 ) ) ) ) ); } /* @@ -172,7 +180,7 @@ HB_FUNC( QT_QBITMAP_TRANSFORMED ) */ HB_FUNC( QT_QBITMAP_TRANSFORMED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ) ) ), release_QBitmap ) ); + hb_retptrGC( gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ) ) ) ) ); } /* @@ -180,7 +188,7 @@ HB_FUNC( QT_QBITMAP_TRANSFORMED_1 ) */ HB_FUNC( QT_QBITMAP_FROMIMAGE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBitmap( hbqt_par_QBitmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ), release_QBitmap ) ); + hb_retptrGC( gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QBoxLayout.cpp b/harbour/contrib/hbqt/qtgui/QBoxLayout.cpp index a9f31b4e24..b270335ba0 100644 --- a/harbour/contrib/hbqt/qtgui/QBoxLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QBoxLayout.cpp @@ -80,52 +80,69 @@ * ~QBoxLayout () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QBoxLayout > pq; +} QGC_POINTER_QBoxLayout; + QT_G_FUNC( release_QBoxLayout ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QBoxLayout * p = ( QGC_POINTER_QBoxLayout * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QBoxLayout p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QBoxLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QBoxLayout * ) ph )->~QBoxLayout(); - ph = NULL; + ( ( QBoxLayout * ) p->ph )->~QBoxLayout(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QBoxLayout Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QBoxLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QBoxLayout Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QBoxLayout" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QBoxLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QBoxLayout Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QBoxLayout" ); + #endif } } +void * gcAllocate_QBoxLayout( void * pObj ) +{ + QGC_POINTER_QBoxLayout * p = ( QGC_POINTER_QBoxLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QBoxLayout ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QBoxLayout; + new( & p->pq ) QPointer< QBoxLayout >( ( QBoxLayout * ) pObj ); + #if defined(__debug__) + just_debug( " new_QBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QBOXLAYOUT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QBoxLayout > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QBoxLayout* ) new QBoxLayout( ( QBoxLayout::Direction ) hb_parni( 1 ), hbqt_par_QWidget( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QBoxLayout; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QBoxLayout( pObj ) ); } /* * void addLayout ( QLayout * layout, int stretch = 0 ) diff --git a/harbour/contrib/hbqt/qtgui/QBrush.cpp b/harbour/contrib/hbqt/qtgui/QBrush.cpp index 22f6c11e0c..b51a74c642 100644 --- a/harbour/contrib/hbqt/qtgui/QBrush.cpp +++ b/harbour/contrib/hbqt/qtgui/QBrush.cpp @@ -87,30 +87,44 @@ QT_G_FUNC( release_QBrush ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QBrush %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QBrush p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QBrush ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QBrush * ) ph )->~QBrush(); - ph = NULL; + ( ( QBrush * ) p->ph )->~QBrush(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QBrush Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QBrush %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QBrush" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QBrush Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QBrush" ); + #endif } } +void * gcAllocate_QBrush( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QBrush; + #if defined(__debug__) + just_debug( " new_QBrush %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QBRUSH ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QBrush %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -166,20 +180,14 @@ hb_snprintf( str, sizeof(str), " GC: new QBrush %i B %i pObj = ( QBrush* ) new QBrush() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QBrush; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QBrush( pObj ) ); } /* * const QColor & color () const */ HB_FUNC( QT_QBRUSH_COLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QBrush( 1 )->color() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QBrush( 1 )->color() ) ) ); } /* @@ -195,7 +203,7 @@ HB_FUNC( QT_QBRUSH_ISOPAQUE ) */ HB_FUNC( QT_QBRUSH_MATRIX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QBrush( 1 )->matrix() ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QBrush( 1 )->matrix() ) ) ); } /* @@ -267,7 +275,7 @@ HB_FUNC( QT_QBRUSH_STYLE ) */ HB_FUNC( QT_QBRUSH_TEXTURE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QBrush( 1 )->texture() ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QBrush( 1 )->texture() ) ) ); } /* @@ -275,7 +283,7 @@ HB_FUNC( QT_QBRUSH_TEXTURE ) */ HB_FUNC( QT_QBRUSH_TEXTUREIMAGE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QBrush( 1 )->textureImage() ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QBrush( 1 )->textureImage() ) ) ); } /* @@ -283,7 +291,7 @@ HB_FUNC( QT_QBRUSH_TEXTUREIMAGE ) */ HB_FUNC( QT_QBRUSH_TRANSFORM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QBrush( 1 )->transform() ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QBrush( 1 )->transform() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QButtonGroup.cpp b/harbour/contrib/hbqt/qtgui/QButtonGroup.cpp index 34a47e5318..de71e154ff 100644 --- a/harbour/contrib/hbqt/qtgui/QButtonGroup.cpp +++ b/harbour/contrib/hbqt/qtgui/QButtonGroup.cpp @@ -85,42 +85,65 @@ * ~QButtonGroup () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QButtonGroup > pq; +} QGC_POINTER_QButtonGroup; + QT_G_FUNC( release_QButtonGroup ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QButtonGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QButtonGroup * p = ( QGC_POINTER_QButtonGroup * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QButtonGroup p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QButtonGroup ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QButtonGroup * ) ph )->~QButtonGroup(); - ph = NULL; + ( ( QButtonGroup * ) p->ph )->~QButtonGroup(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QButtonGroup Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QButtonGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QButtonGroup" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QButtonGroup Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QButtonGroup" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QButtonGroup" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QButtonGroup Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QButtonGroup" ); + #endif } } +void * gcAllocate_QButtonGroup( void * pObj ) +{ + QGC_POINTER_QButtonGroup * p = ( QGC_POINTER_QButtonGroup * ) hb_gcAllocate( sizeof( QGC_POINTER_QButtonGroup ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QButtonGroup; + new( & p->pq ) QPointer< QButtonGroup >( ( QButtonGroup * ) pObj ); + #if defined(__debug__) + just_debug( " new_QButtonGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QBUTTONGROUP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QButtonGroup > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QButtonGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -131,13 +154,7 @@ hb_snprintf( str, sizeof(str), " GC: new QButtonGroup %i B %i pObj = ( QButtonGroup* ) new QButtonGroup() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QButtonGroup; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QButtonGroup( pObj ) ); } /* * void addButton ( QAbstractButton * button ) diff --git a/harbour/contrib/hbqt/qtgui/QCalendarWidget.cpp b/harbour/contrib/hbqt/qtgui/QCalendarWidget.cpp index 629308a8f7..43e1ffe3be 100644 --- a/harbour/contrib/hbqt/qtgui/QCalendarWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QCalendarWidget.cpp @@ -91,52 +91,69 @@ * ~QCalendarWidget () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QCalendarWidget > pq; +} QGC_POINTER_QCalendarWidget; + QT_G_FUNC( release_QCalendarWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QCalendarWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QCalendarWidget * p = ( QGC_POINTER_QCalendarWidget * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QCalendarWidget p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QCalendarWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QCalendarWidget * ) ph )->~QCalendarWidget(); - ph = NULL; + ( ( QCalendarWidget * ) p->ph )->~QCalendarWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QCalendarWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QCalendarWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QCalendarWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCalendarWidget Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QCalendarWidget" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QCalendarWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCalendarWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QCalendarWidget" ); + #endif } } +void * gcAllocate_QCalendarWidget( void * pObj ) +{ + QGC_POINTER_QCalendarWidget * p = ( QGC_POINTER_QCalendarWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QCalendarWidget ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QCalendarWidget; + new( & p->pq ) QPointer< QCalendarWidget >( ( QCalendarWidget * ) pObj ); + #if defined(__debug__) + just_debug( " new_QCalendarWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCALENDARWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QCalendarWidget > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QCalendarWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QCalendarWidget* ) new QCalendarWidget( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QCalendarWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QCalendarWidget( pObj ) ); } /* * int dateEditAcceptDelay () const @@ -151,7 +168,7 @@ HB_FUNC( QT_QCALENDARWIDGET_DATEEDITACCEPTDELAY ) */ HB_FUNC( QT_QCALENDARWIDGET_DATETEXTFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->dateTextFormat( *hbqt_par_QDate( 2 ) ) ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->dateTextFormat( *hbqt_par_QDate( 2 ) ) ) ) ); } /* @@ -167,7 +184,7 @@ HB_FUNC( QT_QCALENDARWIDGET_FIRSTDAYOFWEEK ) */ HB_FUNC( QT_QCALENDARWIDGET_HEADERTEXTFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->headerTextFormat() ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->headerTextFormat() ) ) ); } /* @@ -207,7 +224,7 @@ HB_FUNC( QT_QCALENDARWIDGET_ISNAVIGATIONBARVISIBLE ) */ HB_FUNC( QT_QCALENDARWIDGET_MAXIMUMDATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QCalendarWidget( 1 )->maximumDate() ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->maximumDate() ) ) ); } /* @@ -215,7 +232,7 @@ HB_FUNC( QT_QCALENDARWIDGET_MAXIMUMDATE ) */ HB_FUNC( QT_QCALENDARWIDGET_MINIMUMDATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QCalendarWidget( 1 )->minimumDate() ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->minimumDate() ) ) ); } /* @@ -231,7 +248,7 @@ HB_FUNC( QT_QCALENDARWIDGET_MONTHSHOWN ) */ HB_FUNC( QT_QCALENDARWIDGET_SELECTEDDATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QCalendarWidget( 1 )->selectedDate() ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->selectedDate() ) ) ); } /* @@ -343,7 +360,7 @@ HB_FUNC( QT_QCALENDARWIDGET_VERTICALHEADERFORMAT ) */ HB_FUNC( QT_QCALENDARWIDGET_WEEKDAYTEXTFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->weekdayTextFormat( ( Qt::DayOfWeek ) hb_parni( 2 ) ) ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->weekdayTextFormat( ( Qt::DayOfWeek ) hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QCheckBox.cpp b/harbour/contrib/hbqt/qtgui/QCheckBox.cpp index ec057e6539..165c06a7df 100644 --- a/harbour/contrib/hbqt/qtgui/QCheckBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QCheckBox.cpp @@ -76,42 +76,65 @@ * QCheckBox ( const QString & text, QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QCheckBox > pq; +} QGC_POINTER_QCheckBox; + QT_G_FUNC( release_QCheckBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QCheckBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QCheckBox * p = ( QGC_POINTER_QCheckBox * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QCheckBox p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QCheckBox ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QCheckBox * ) ph )->~QCheckBox(); - ph = NULL; + ( ( QCheckBox * ) p->ph )->~QCheckBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QCheckBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QCheckBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QCheckBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCheckBox Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QCheckBox" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QCheckBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCheckBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QCheckBox" ); + #endif } } +void * gcAllocate_QCheckBox( void * pObj ) +{ + QGC_POINTER_QCheckBox * p = ( QGC_POINTER_QCheckBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QCheckBox ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QCheckBox; + new( & p->pq ) QPointer< QCheckBox >( ( QCheckBox * ) pObj ); + #if defined(__debug__) + just_debug( " new_QCheckBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCHECKBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QCheckBox > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QCheckBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 1 && HB_ISCHAR( 1 ) ) { @@ -122,13 +145,7 @@ hb_snprintf( str, sizeof(str), " GC: new QCheckBox %i B %i pObj = ( QCheckBox* ) new QCheckBox( hbqt_par_QWidget( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QCheckBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QCheckBox( pObj ) ); } /* * Qt::CheckState checkState () const diff --git a/harbour/contrib/hbqt/qtgui/QClipboard.cpp b/harbour/contrib/hbqt/qtgui/QClipboard.cpp index 2887f422e6..9201cf1734 100644 --- a/harbour/contrib/hbqt/qtgui/QClipboard.cpp +++ b/harbour/contrib/hbqt/qtgui/QClipboard.cpp @@ -88,16 +88,10 @@ QT_G_FUNC( release_QClipboard ) HB_FUNC( QT_QCLIPBOARD ) { - QPointer< QClipboard > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " NON-GC: new QClipboard %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QClipboard* ) QApplication::clipboard() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " NON-GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif hb_retptr( pObj ); } /* @@ -113,7 +107,7 @@ HB_FUNC( QT_QCLIPBOARD_CLEAR ) */ HB_FUNC( QT_QCLIPBOARD_IMAGE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QClipboard( 1 )->image( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QClipboard( 1 )->image( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ) ) ); } /* @@ -153,7 +147,7 @@ HB_FUNC( QT_QCLIPBOARD_OWNSSELECTION ) */ HB_FUNC( QT_QCLIPBOARD_PIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QClipboard( 1 )->pixmap( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QClipboard( 1 )->pixmap( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QColor.cpp b/harbour/contrib/hbqt/qtgui/QColor.cpp index 7fa3c374e1..82c3231606 100644 --- a/harbour/contrib/hbqt/qtgui/QColor.cpp +++ b/harbour/contrib/hbqt/qtgui/QColor.cpp @@ -87,30 +87,44 @@ QColor ( const QColor & color ) QT_G_FUNC( release_QColor ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QColor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QColor p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QColor ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QColor * ) ph )->~QColor(); - ph = NULL; + ( ( QColor * ) p->ph )->~QColor(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QColor Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QColor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QColor" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QColor Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QColor" ); + #endif } } +void * gcAllocate_QColor( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QColor; + #if defined(__debug__) + just_debug( " new_QColor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCOLOR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QColor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() >= 1 ) { @@ -148,13 +162,7 @@ hb_snprintf( str, sizeof(str), " GC: new QColor %i B %i pObj = ( QColor* ) new QColor() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QColor; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QColor( pObj ) ); } /* * int alpha () const @@ -209,7 +217,7 @@ HB_FUNC( QT_QCOLOR_BLUEF ) */ HB_FUNC( QT_QCOLOR_CONVERTTO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->convertTo( ( QColor::Spec ) hb_parni( 2 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->convertTo( ( QColor::Spec ) hb_parni( 2 ) ) ) ) ); } /* @@ -233,7 +241,7 @@ HB_FUNC( QT_QCOLOR_CYANF ) */ HB_FUNC( QT_QCOLOR_DARKER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->darker( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 200 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->darker( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 200 ) ) ) ) ); } /* @@ -393,7 +401,7 @@ HB_FUNC( QT_QCOLOR_ISVALID ) */ HB_FUNC( QT_QCOLOR_LIGHTER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->lighter( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 150 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->lighter( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 150 ) ) ) ) ); } /* @@ -617,7 +625,7 @@ HB_FUNC( QT_QCOLOR_SPEC ) */ HB_FUNC( QT_QCOLOR_TOCMYK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->toCmyk() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toCmyk() ) ) ); } /* @@ -625,7 +633,7 @@ HB_FUNC( QT_QCOLOR_TOCMYK ) */ HB_FUNC( QT_QCOLOR_TOHSV ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->toHsv() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toHsv() ) ) ); } /* @@ -633,7 +641,7 @@ HB_FUNC( QT_QCOLOR_TOHSV ) */ HB_FUNC( QT_QCOLOR_TORGB ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->toRgb() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toRgb() ) ) ); } /* @@ -673,7 +681,7 @@ HB_FUNC( QT_QCOLOR_YELLOWF ) */ HB_FUNC( QT_QCOLOR_COLORNAMES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QColor( 1 )->colorNames() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QColor( 1 )->colorNames() ) ) ); } /* @@ -681,7 +689,7 @@ HB_FUNC( QT_QCOLOR_COLORNAMES ) */ HB_FUNC( QT_QCOLOR_FROMCMYK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->fromCmyk( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), ( HB_ISNUM( 6 ) ? hb_parni( 6 ) : 255 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromCmyk( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), ( HB_ISNUM( 6 ) ? hb_parni( 6 ) : 255 ) ) ) ) ); } /* @@ -689,7 +697,7 @@ HB_FUNC( QT_QCOLOR_FROMCMYK ) */ HB_FUNC( QT_QCOLOR_FROMCMYKF ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->fromCmykF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromCmykF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) ) ) ) ); } /* @@ -697,7 +705,7 @@ HB_FUNC( QT_QCOLOR_FROMCMYKF ) */ HB_FUNC( QT_QCOLOR_FROMHSV ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->fromHsv( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : 255 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromHsv( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : 255 ) ) ) ) ); } /* @@ -705,7 +713,7 @@ HB_FUNC( QT_QCOLOR_FROMHSV ) */ HB_FUNC( QT_QCOLOR_FROMHSVF ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->fromHsvF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromHsvF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ) ) ); } /* @@ -713,7 +721,7 @@ HB_FUNC( QT_QCOLOR_FROMHSVF ) */ HB_FUNC( QT_QCOLOR_FROMRGB ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->fromRgb( hb_parnl( 2 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgb( hb_parnl( 2 ) ) ) ) ); } /* @@ -721,7 +729,7 @@ HB_FUNC( QT_QCOLOR_FROMRGB ) */ HB_FUNC( QT_QCOLOR_FROMRGB_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->fromRgb( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : 255 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgb( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : 255 ) ) ) ) ); } /* @@ -729,7 +737,7 @@ HB_FUNC( QT_QCOLOR_FROMRGB_1 ) */ HB_FUNC( QT_QCOLOR_FROMRGBF ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->fromRgbF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgbF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ) ) ); } /* @@ -737,7 +745,7 @@ HB_FUNC( QT_QCOLOR_FROMRGBF ) */ HB_FUNC( QT_QCOLOR_FROMRGBA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColor( 1 )->fromRgba( hb_parnl( 2 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgba( hb_parnl( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QColorDialog.cpp b/harbour/contrib/hbqt/qtgui/QColorDialog.cpp index 5173060a9c..f7ab6c8070 100644 --- a/harbour/contrib/hbqt/qtgui/QColorDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QColorDialog.cpp @@ -81,42 +81,65 @@ * ~QColorDialog () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QColorDialog > pq; +} QGC_POINTER_QColorDialog; + QT_G_FUNC( release_QColorDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QColorDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QColorDialog * p = ( QGC_POINTER_QColorDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QColorDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QColorDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QColorDialog * ) ph )->~QColorDialog(); - ph = NULL; + ( ( QColorDialog * ) p->ph )->~QColorDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QColorDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QColorDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QColorDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QColorDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QColorDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QColorDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QColorDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QColorDialog" ); + #endif } } +void * gcAllocate_QColorDialog( void * pObj ) +{ + QGC_POINTER_QColorDialog * p = ( QGC_POINTER_QColorDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QColorDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QColorDialog; + new( & p->pq ) QPointer< QColorDialog >( ( QColorDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QColorDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCOLORDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QColorDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QColorDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 1 && HB_ISNUM( 1 ) ) { @@ -127,20 +150,14 @@ hb_snprintf( str, sizeof(str), " GC: new QColorDialog %i B %i pObj = ( QColorDialog* ) new QColorDialog( hbqt_par_QWidget( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QColorDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QColorDialog( pObj ) ); } /* * QColor currentColor () const */ HB_FUNC( QT_QCOLORDIALOG_CURRENTCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColorDialog( 1 )->currentColor() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->currentColor() ) ) ); } /* @@ -164,7 +181,7 @@ HB_FUNC( QT_QCOLORDIALOG_OPTIONS ) */ HB_FUNC( QT_QCOLORDIALOG_SELECTEDCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColorDialog( 1 )->selectedColor() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->selectedColor() ) ) ); } /* @@ -228,7 +245,7 @@ HB_FUNC( QT_QCOLORDIALOG_CUSTOMCOUNT ) */ HB_FUNC( QT_QCOLORDIALOG_GETCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColorDialog( 1 )->getColor( *hbqt_par_QColor( 2 ), hbqt_par_QWidget( 3 ), hbqt_par_QString( 4 ), ( QColorDialog::ColorDialogOptions ) hb_parni( 5 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->getColor( *hbqt_par_QColor( 2 ), hbqt_par_QWidget( 3 ), hbqt_par_QString( 4 ), ( QColorDialog::ColorDialogOptions ) hb_parni( 5 ) ) ) ) ); } /* @@ -236,7 +253,7 @@ HB_FUNC( QT_QCOLORDIALOG_GETCOLOR ) */ HB_FUNC( QT_QCOLORDIALOG_GETCOLOR_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QColorDialog( 1 )->getColor( *hbqt_par_QColor( 2 ), hbqt_par_QWidget( 3 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->getColor( *hbqt_par_QColor( 2 ), hbqt_par_QWidget( 3 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QComboBox.cpp b/harbour/contrib/hbqt/qtgui/QComboBox.cpp index d01ae7926b..68e75076a0 100644 --- a/harbour/contrib/hbqt/qtgui/QComboBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QComboBox.cpp @@ -81,52 +81,69 @@ * ~QComboBox () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QComboBox > pq; +} QGC_POINTER_QComboBox; + QT_G_FUNC( release_QComboBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QComboBox * p = ( QGC_POINTER_QComboBox * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QComboBox p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QComboBox ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QComboBox * ) ph )->~QComboBox(); - ph = NULL; + ( ( QComboBox * ) p->ph )->~QComboBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QComboBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QComboBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QComboBox Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QComboBox" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QComboBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QComboBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QComboBox" ); + #endif } } +void * gcAllocate_QComboBox( void * pObj ) +{ + QGC_POINTER_QComboBox * p = ( QGC_POINTER_QComboBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QComboBox ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QComboBox; + new( & p->pq ) QPointer< QComboBox >( ( QComboBox * ) pObj ); + #if defined(__debug__) + just_debug( " new_QComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCOMBOBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QComboBox > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QComboBox* ) new QComboBox( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QComboBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QComboBox( pObj ) ); } /* * void addItem ( const QString & text, const QVariant & userData = QVariant() ) @@ -229,7 +246,7 @@ HB_FUNC( QT_QCOMBOBOX_HIDEPOPUP ) */ HB_FUNC( QT_QCOMBOBOX_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QComboBox( 1 )->iconSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QComboBox( 1 )->iconSize() ) ) ); } /* @@ -285,7 +302,7 @@ HB_FUNC( QT_QCOMBOBOX_ISEDITABLE ) */ HB_FUNC( QT_QCOMBOBOX_ITEMDATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QComboBox( 1 )->itemData( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::UserRole ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QComboBox( 1 )->itemData( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::UserRole ) ) ) ) ); } /* @@ -301,7 +318,7 @@ HB_FUNC( QT_QCOMBOBOX_ITEMDELEGATE ) */ HB_FUNC( QT_QCOMBOBOX_ITEMICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QComboBox( 1 )->itemIcon( hb_parni( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QComboBox( 1 )->itemIcon( hb_parni( 2 ) ) ) ) ); } /* @@ -373,7 +390,7 @@ HB_FUNC( QT_QCOMBOBOX_REMOVEITEM ) */ HB_FUNC( QT_QCOMBOBOX_ROOTMODELINDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QComboBox( 1 )->rootModelIndex() ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QComboBox( 1 )->rootModelIndex() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QCommandLinkButton.cpp b/harbour/contrib/hbqt/qtgui/QCommandLinkButton.cpp index eb7eb964a6..efc402f814 100644 --- a/harbour/contrib/hbqt/qtgui/QCommandLinkButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QCommandLinkButton.cpp @@ -77,52 +77,69 @@ * QCommandLinkButton ( const QString & text, const QString & description, QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QCommandLinkButton > pq; +} QGC_POINTER_QCommandLinkButton; + QT_G_FUNC( release_QCommandLinkButton ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QCommandLinkButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QCommandLinkButton * p = ( QGC_POINTER_QCommandLinkButton * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QCommandLinkButton p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QCommandLinkButton ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QCommandLinkButton * ) ph )->~QCommandLinkButton(); - ph = NULL; + ( ( QCommandLinkButton * ) p->ph )->~QCommandLinkButton(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QCommandLinkButton Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QCommandLinkButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QCommandLinkButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCommandLinkButton Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QCommandLinkButton" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QCommandLinkButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCommandLinkButton Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QCommandLinkButton" ); + #endif } } +void * gcAllocate_QCommandLinkButton( void * pObj ) +{ + QGC_POINTER_QCommandLinkButton * p = ( QGC_POINTER_QCommandLinkButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QCommandLinkButton ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QCommandLinkButton; + new( & p->pq ) QPointer< QCommandLinkButton >( ( QCommandLinkButton * ) pObj ); + #if defined(__debug__) + just_debug( " new_QCommandLinkButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCOMMANDLINKBUTTON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QCommandLinkButton > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QCommandLinkButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QCommandLinkButton* ) new QCommandLinkButton( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QCommandLinkButton; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QCommandLinkButton( pObj ) ); } /* * QString description () const diff --git a/harbour/contrib/hbqt/qtgui/QCommonStyle.cpp b/harbour/contrib/hbqt/qtgui/QCommonStyle.cpp index f451cb1f77..f08e50572a 100644 --- a/harbour/contrib/hbqt/qtgui/QCommonStyle.cpp +++ b/harbour/contrib/hbqt/qtgui/QCommonStyle.cpp @@ -75,52 +75,69 @@ * QCommonStyle () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QCommonStyle > pq; +} QGC_POINTER_QCommonStyle; + QT_G_FUNC( release_QCommonStyle ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QCommonStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QCommonStyle * p = ( QGC_POINTER_QCommonStyle * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QCommonStyle p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QCommonStyle ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QCommonStyle * ) ph )->~QCommonStyle(); - ph = NULL; + ( ( QCommonStyle * ) p->ph )->~QCommonStyle(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QCommonStyle Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QCommonStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QCommonStyle" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCommonStyle Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QCommonStyle" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QCommonStyle" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCommonStyle Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QCommonStyle" ); + #endif } } +void * gcAllocate_QCommonStyle( void * pObj ) +{ + QGC_POINTER_QCommonStyle * p = ( QGC_POINTER_QCommonStyle * ) hb_gcAllocate( sizeof( QGC_POINTER_QCommonStyle ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QCommonStyle; + new( & p->pq ) QPointer< QCommonStyle >( ( QCommonStyle * ) pObj ); + #if defined(__debug__) + just_debug( " new_QCommonStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCOMMONSTYLE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QCommonStyle > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QCommonStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QCommonStyle* ) new QCommonStyle() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QCommonStyle; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QCommonStyle( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QCompleter.cpp b/harbour/contrib/hbqt/qtgui/QCompleter.cpp index 2c792a1cd1..9b5746d249 100644 --- a/harbour/contrib/hbqt/qtgui/QCompleter.cpp +++ b/harbour/contrib/hbqt/qtgui/QCompleter.cpp @@ -82,52 +82,69 @@ * ~QCompleter () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QCompleter > pq; +} QGC_POINTER_QCompleter; + QT_G_FUNC( release_QCompleter ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QCompleter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QCompleter * p = ( QGC_POINTER_QCompleter * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QCompleter p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QCompleter ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QCompleter * ) ph )->~QCompleter(); - ph = NULL; + ( ( QCompleter * ) p->ph )->~QCompleter(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QCompleter Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QCompleter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QCompleter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCompleter Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QCompleter" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QCompleter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCompleter Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QCompleter" ); + #endif } } +void * gcAllocate_QCompleter( void * pObj ) +{ + QGC_POINTER_QCompleter * p = ( QGC_POINTER_QCompleter * ) hb_gcAllocate( sizeof( QGC_POINTER_QCompleter ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QCompleter; + new( & p->pq ) QPointer< QCompleter >( ( QCompleter * ) pObj ); + #if defined(__debug__) + just_debug( " new_QCompleter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCOMPLETER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QCompleter > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QCompleter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QCompleter() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QCompleter; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QCompleter( pObj ) ); } /* * Qt::CaseSensitivity caseSensitivity () const @@ -198,7 +215,7 @@ HB_FUNC( QT_QCOMPLETER_CURRENTCOMPLETION ) */ HB_FUNC( QT_QCOMPLETER_CURRENTINDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QCompleter( 1 )->currentIndex() ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QCompleter( 1 )->currentIndex() ) ) ); } /* @@ -318,7 +335,7 @@ HB_FUNC( QT_QCOMPLETER_SETWIDGET ) */ HB_FUNC( QT_QCOMPLETER_SPLITPATH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QCompleter( 1 )->splitPath( hbqt_par_QString( 2 ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QCompleter( 1 )->splitPath( hbqt_par_QString( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QConicalGradient.cpp b/harbour/contrib/hbqt/qtgui/QConicalGradient.cpp index 45e57f190f..01ccb71d5a 100644 --- a/harbour/contrib/hbqt/qtgui/QConicalGradient.cpp +++ b/harbour/contrib/hbqt/qtgui/QConicalGradient.cpp @@ -85,40 +85,48 @@ QT_G_FUNC( release_QConicalGradient ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QConicalGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QConicalGradient p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QConicalGradient ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QConicalGradient * ) ph )->~QConicalGradient(); - ph = NULL; + ( ( QConicalGradient * ) p->ph )->~QConicalGradient(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QConicalGradient Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QConicalGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QConicalGradient" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QConicalGradient Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QConicalGradient" ); + #endif } } +void * gcAllocate_QConicalGradient( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QConicalGradient; + #if defined(__debug__) + just_debug( " new_QConicalGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCONICALGRADIENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QConicalGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QConicalGradient* ) new QConicalGradient() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QConicalGradient; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QConicalGradient( pObj ) ); } /* * qreal angle () const @@ -133,7 +141,7 @@ HB_FUNC( QT_QCONICALGRADIENT_ANGLE ) */ HB_FUNC( QT_QCONICALGRADIENT_CENTER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QConicalGradient( 1 )->center() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QConicalGradient( 1 )->center() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QContextMenuEvent.cpp b/harbour/contrib/hbqt/qtgui/QContextMenuEvent.cpp index b6c7a98b7c..ae623ce814 100644 --- a/harbour/contrib/hbqt/qtgui/QContextMenuEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QContextMenuEvent.cpp @@ -82,47 +82,55 @@ QT_G_FUNC( release_QContextMenuEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QContextMenuEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QContextMenuEvent p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QContextMenuEvent ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QContextMenuEvent * ) ph )->~QContextMenuEvent(); - ph = NULL; + ( ( QContextMenuEvent * ) p->ph )->~QContextMenuEvent(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QContextMenuEvent Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QContextMenuEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QContextMenuEvent" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QContextMenuEvent Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QContextMenuEvent" ); + #endif } } +void * gcAllocate_QContextMenuEvent( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QContextMenuEvent; + #if defined(__debug__) + just_debug( " new_QContextMenuEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCONTEXTMENUEVENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QContextMenuEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QContextMenuEvent( ( QContextMenuEvent::Reason ) hb_parni( 1 ), *hbqt_par_QPoint( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QContextMenuEvent; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QContextMenuEvent( pObj ) ); } /* * const QPoint & globalPos () const */ HB_FUNC( QT_QCONTEXTMENUEVENT_GLOBALPOS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QContextMenuEvent( 1 )->globalPos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QContextMenuEvent( 1 )->globalPos() ) ) ); } /* @@ -146,7 +154,7 @@ HB_FUNC( QT_QCONTEXTMENUEVENT_GLOBALY ) */ HB_FUNC( QT_QCONTEXTMENUEVENT_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QContextMenuEvent( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QContextMenuEvent( 1 )->pos() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QCursor.cpp b/harbour/contrib/hbqt/qtgui/QCursor.cpp index 0b2fab8809..9675b45bdb 100644 --- a/harbour/contrib/hbqt/qtgui/QCursor.cpp +++ b/harbour/contrib/hbqt/qtgui/QCursor.cpp @@ -84,30 +84,44 @@ QT_G_FUNC( release_QCursor ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QCursor p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QCursor ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QCursor * ) ph )->~QCursor(); - ph = NULL; + ( ( QCursor * ) p->ph )->~QCursor(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QCursor Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QCursor" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QCursor Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QCursor" ); + #endif } } +void * gcAllocate_QCursor( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QCursor; + #if defined(__debug__) + just_debug( " new_QCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QCURSOR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISNUM( 1 ) ) { @@ -139,13 +153,7 @@ hb_snprintf( str, sizeof(str), " GC: new QCursor %i B %i pObj = ( QCursor* ) new QCursor() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QCursor; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QCursor( pObj ) ); } /* * const QBitmap * bitmap () const @@ -160,7 +168,7 @@ HB_FUNC( QT_QCURSOR_BITMAP ) */ HB_FUNC( QT_QCURSOR_HOTSPOT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QCursor( 1 )->hotSpot() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QCursor( 1 )->hotSpot() ) ) ); } /* @@ -176,7 +184,7 @@ HB_FUNC( QT_QCURSOR_MASK ) */ HB_FUNC( QT_QCURSOR_PIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QCursor( 1 )->pixmap() ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QCursor( 1 )->pixmap() ) ) ); } /* @@ -200,7 +208,7 @@ HB_FUNC( QT_QCURSOR_SHAPE ) */ HB_FUNC( QT_QCURSOR_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QCursor( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QCursor( 1 )->pos() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDateEdit.cpp b/harbour/contrib/hbqt/qtgui/QDateEdit.cpp index cc3b4e1449..6c8665b1be 100644 --- a/harbour/contrib/hbqt/qtgui/QDateEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QDateEdit.cpp @@ -76,52 +76,69 @@ * QDateEdit ( const QDate & date, QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QDateEdit > pq; +} QGC_POINTER_QDateEdit; + QT_G_FUNC( release_QDateEdit ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDateEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QDateEdit * p = ( QGC_POINTER_QDateEdit * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDateEdit p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QDateEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QDateEdit * ) ph )->~QDateEdit(); - ph = NULL; + ( ( QDateEdit * ) p->ph )->~QDateEdit(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDateEdit Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDateEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDateEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDateEdit Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QDateEdit" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDateEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDateEdit Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDateEdit" ); + #endif } } +void * gcAllocate_QDateEdit( void * pObj ) +{ + QGC_POINTER_QDateEdit * p = ( QGC_POINTER_QDateEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QDateEdit ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDateEdit; + new( & p->pq ) QPointer< QDateEdit >( ( QDateEdit * ) pObj ); + #if defined(__debug__) + just_debug( " new_QDateEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDATEEDIT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QDateEdit > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDateEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QDateEdit* ) new QDateEdit( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDateEdit; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDateEdit( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QDateTimeEdit.cpp b/harbour/contrib/hbqt/qtgui/QDateTimeEdit.cpp index a2223394e7..4594107f3d 100644 --- a/harbour/contrib/hbqt/qtgui/QDateTimeEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QDateTimeEdit.cpp @@ -83,52 +83,69 @@ * QDateTimeEdit ( const QTime & time, QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QDateTimeEdit > pq; +} QGC_POINTER_QDateTimeEdit; + QT_G_FUNC( release_QDateTimeEdit ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDateTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QDateTimeEdit * p = ( QGC_POINTER_QDateTimeEdit * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTimeEdit p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTimeEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QDateTimeEdit * ) ph )->~QDateTimeEdit(); - ph = NULL; + ( ( QDateTimeEdit * ) p->ph )->~QDateTimeEdit(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTimeEdit Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDateTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDateTimeEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTimeEdit Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QDateTimeEdit" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDateTimeEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDateTimeEdit Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDateTimeEdit" ); + #endif } } +void * gcAllocate_QDateTimeEdit( void * pObj ) +{ + QGC_POINTER_QDateTimeEdit * p = ( QGC_POINTER_QDateTimeEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QDateTimeEdit ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDateTimeEdit; + new( & p->pq ) QPointer< QDateTimeEdit >( ( QDateTimeEdit * ) pObj ); + #if defined(__debug__) + just_debug( " new_QDateTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDATETIMEEDIT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QDateTimeEdit > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDateTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QDateTimeEdit* ) new QDateTimeEdit( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDateTimeEdit; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDateTimeEdit( pObj ) ); } /* * bool calendarPopup () const @@ -215,7 +232,7 @@ HB_FUNC( QT_QDATETIMEEDIT_CURRENTSECTIONINDEX ) */ HB_FUNC( QT_QDATETIMEEDIT_DATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QDateTimeEdit( 1 )->date() ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->date() ) ) ); } /* @@ -223,7 +240,7 @@ HB_FUNC( QT_QDATETIMEEDIT_DATE ) */ HB_FUNC( QT_QDATETIMEEDIT_DATETIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->dateTime() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->dateTime() ) ) ); } /* @@ -247,7 +264,7 @@ HB_FUNC( QT_QDATETIMEEDIT_DISPLAYEDSECTIONS ) */ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMDATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QDateTimeEdit( 1 )->maximumDate() ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->maximumDate() ) ) ); } /* @@ -255,7 +272,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMDATE ) */ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMDATETIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->maximumDateTime() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->maximumDateTime() ) ) ); } /* @@ -263,7 +280,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMDATETIME ) */ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMTIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QDateTimeEdit( 1 )->maximumTime() ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->maximumTime() ) ) ); } /* @@ -271,7 +288,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMTIME ) */ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMDATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDate( hbqt_par_QDateTimeEdit( 1 )->minimumDate() ), release_QDate ) ); + hb_retptrGC( gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->minimumDate() ) ) ); } /* @@ -279,7 +296,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMDATE ) */ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMDATETIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->minimumDateTime() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->minimumDateTime() ) ) ); } /* @@ -287,7 +304,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMDATETIME ) */ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMTIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QDateTimeEdit( 1 )->minimumTime() ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->minimumTime() ) ) ); } /* @@ -447,7 +464,7 @@ HB_FUNC( QT_QDATETIMEEDIT_SETTIMESPEC ) */ HB_FUNC( QT_QDATETIMEEDIT_TIME ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTime( hbqt_par_QDateTimeEdit( 1 )->time() ), release_QTime ) ); + hb_retptrGC( gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->time() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDesktopWidget.cpp b/harbour/contrib/hbqt/qtgui/QDesktopWidget.cpp index aa61b8c554..5da603bbe9 100644 --- a/harbour/contrib/hbqt/qtgui/QDesktopWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QDesktopWidget.cpp @@ -76,59 +76,76 @@ * ~QDesktopWidget () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QDesktopWidget > pq; +} QGC_POINTER_QDesktopWidget; + QT_G_FUNC( release_QDesktopWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDesktopWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QDesktopWidget * p = ( QGC_POINTER_QDesktopWidget * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDesktopWidget p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QDesktopWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QDesktopWidget * ) ph )->~QDesktopWidget(); - ph = NULL; + ( ( QDesktopWidget * ) p->ph )->~QDesktopWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDesktopWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDesktopWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDesktopWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDesktopWidget Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QDesktopWidget" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDesktopWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDesktopWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDesktopWidget" ); + #endif } } +void * gcAllocate_QDesktopWidget( void * pObj ) +{ + QGC_POINTER_QDesktopWidget * p = ( QGC_POINTER_QDesktopWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QDesktopWidget ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDesktopWidget; + new( & p->pq ) QPointer< QDesktopWidget >( ( QDesktopWidget * ) pObj ); + #if defined(__debug__) + just_debug( " new_QDesktopWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDESKTOPWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QDesktopWidget > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDesktopWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QDesktopWidget() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDesktopWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDesktopWidget( pObj ) ); } /* * const QRect availableGeometry ( int screen = -1 ) const */ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ) ) ); } /* @@ -136,7 +153,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY ) */ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( hbqt_par_QWidget( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( hbqt_par_QWidget( 2 ) ) ) ) ); } /* @@ -144,7 +161,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY_1 ) */ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( *hbqt_par_QPoint( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -184,7 +201,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_SCREEN ) */ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ) ) ); } /* @@ -192,7 +209,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY ) */ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( hbqt_par_QWidget( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( hbqt_par_QWidget( 2 ) ) ) ) ); } /* @@ -200,7 +217,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY_1 ) */ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( *hbqt_par_QPoint( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDial.cpp b/harbour/contrib/hbqt/qtgui/QDial.cpp index fcf5b3f330..84ce4269cb 100644 --- a/harbour/contrib/hbqt/qtgui/QDial.cpp +++ b/harbour/contrib/hbqt/qtgui/QDial.cpp @@ -76,52 +76,69 @@ * ~QDial () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QDial > pq; +} QGC_POINTER_QDial; + QT_G_FUNC( release_QDial ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDial %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QDial * p = ( QGC_POINTER_QDial * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDial p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QDial ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QDial * ) ph )->~QDial(); - ph = NULL; + ( ( QDial * ) p->ph )->~QDial(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDial Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDial %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDial" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDial Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QDial" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDial" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDial Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDial" ); + #endif } } +void * gcAllocate_QDial( void * pObj ) +{ + QGC_POINTER_QDial * p = ( QGC_POINTER_QDial * ) hb_gcAllocate( sizeof( QGC_POINTER_QDial ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDial; + new( & p->pq ) QPointer< QDial >( ( QDial * ) pObj ); + #if defined(__debug__) + just_debug( " new_QDial %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDIAL ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QDial > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDial %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QDial* ) new QDial( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDial; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDial( pObj ) ); } /* * int notchSize () const diff --git a/harbour/contrib/hbqt/qtgui/QDialog.cpp b/harbour/contrib/hbqt/qtgui/QDialog.cpp index 9c781b1326..90834d9c65 100644 --- a/harbour/contrib/hbqt/qtgui/QDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QDialog.cpp @@ -80,52 +80,69 @@ * ~QDialog () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QDialog > pq; +} QGC_POINTER_QDialog; + QT_G_FUNC( release_QDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QDialog * p = ( QGC_POINTER_QDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QDialog * ) ph )->~QDialog(); - ph = NULL; + ( ( QDialog * ) p->ph )->~QDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDialog" ); + #endif } } +void * gcAllocate_QDialog( void * pObj ) +{ + QGC_POINTER_QDialog * p = ( QGC_POINTER_QDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDialog; + new( & p->pq ) QPointer< QDialog >( ( QDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QDialog( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDialog( pObj ) ); } /* * bool isSizeGripEnabled () const diff --git a/harbour/contrib/hbqt/qtgui/QDirModel.cpp b/harbour/contrib/hbqt/qtgui/QDirModel.cpp index 144ae3cf1c..b731737b0c 100644 --- a/harbour/contrib/hbqt/qtgui/QDirModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QDirModel.cpp @@ -81,52 +81,69 @@ * ~QDirModel () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QDirModel > pq; +} QGC_POINTER_QDirModel; + QT_G_FUNC( release_QDirModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDirModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QDirModel * p = ( QGC_POINTER_QDirModel * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDirModel p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QDirModel ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QDirModel * ) ph )->~QDirModel(); - ph = NULL; + ( ( QDirModel * ) p->ph )->~QDirModel(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDirModel Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDirModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDirModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDirModel Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QDirModel" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDirModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDirModel Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDirModel" ); + #endif } } +void * gcAllocate_QDirModel( void * pObj ) +{ + QGC_POINTER_QDirModel * p = ( QGC_POINTER_QDirModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QDirModel ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDirModel; + new( & p->pq ) QPointer< QDirModel >( ( QDirModel * ) pObj ); + #if defined(__debug__) + just_debug( " new_QDirModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDIRMODEL ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QDirModel > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDirModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QDirModel* ) new QDirModel( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDirModel; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDirModel( pObj ) ); } /* * virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const @@ -141,7 +158,7 @@ HB_FUNC( QT_QDIRMODEL_COLUMNCOUNT ) */ HB_FUNC( QT_QDIRMODEL_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QDirModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QDirModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ) ) ); } /* @@ -157,7 +174,7 @@ HB_FUNC( QT_QDIRMODEL_DROPMIMEDATA ) */ HB_FUNC( QT_QDIRMODEL_FILEICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QDirModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QDirModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -165,7 +182,7 @@ HB_FUNC( QT_QDIRMODEL_FILEICON ) */ HB_FUNC( QT_QDIRMODEL_FILEINFO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFileInfo( hbqt_par_QDirModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ), release_QFileInfo ) ); + hb_retptrGC( gcAllocate_QFileInfo( new QFileInfo( hbqt_par_QDirModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -213,7 +230,7 @@ HB_FUNC( QT_QDIRMODEL_HASCHILDREN ) */ HB_FUNC( QT_QDIRMODEL_HEADERDATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QDirModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QDirModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ) ) ); } /* @@ -229,7 +246,7 @@ HB_FUNC( QT_QDIRMODEL_ICONPROVIDER ) */ HB_FUNC( QT_QDIRMODEL_INDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QDirModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ) ) ); } /* @@ -237,7 +254,7 @@ HB_FUNC( QT_QDIRMODEL_INDEX ) */ HB_FUNC( QT_QDIRMODEL_INDEX_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QDirModel( 1 )->index( hbqt_par_QString( 2 ), hb_parni( 3 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->index( hbqt_par_QString( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -269,7 +286,7 @@ HB_FUNC( QT_QDIRMODEL_LAZYCHILDCOUNT ) */ HB_FUNC( QT_QDIRMODEL_MIMETYPES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QDirModel( 1 )->mimeTypes() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QDirModel( 1 )->mimeTypes() ) ) ); } /* @@ -277,7 +294,7 @@ HB_FUNC( QT_QDIRMODEL_MIMETYPES ) */ HB_FUNC( QT_QDIRMODEL_MKDIR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QDirModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), hbqt_par_QString( 3 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* @@ -285,7 +302,7 @@ HB_FUNC( QT_QDIRMODEL_MKDIR ) */ HB_FUNC( QT_QDIRMODEL_NAMEFILTERS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QDirModel( 1 )->nameFilters() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QDirModel( 1 )->nameFilters() ) ) ); } /* @@ -293,7 +310,7 @@ HB_FUNC( QT_QDIRMODEL_NAMEFILTERS ) */ HB_FUNC( QT_QDIRMODEL_PARENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QDirModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDockWidget.cpp b/harbour/contrib/hbqt/qtgui/QDockWidget.cpp index ef4bdaebaa..a7bd645ccb 100644 --- a/harbour/contrib/hbqt/qtgui/QDockWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QDockWidget.cpp @@ -82,52 +82,69 @@ * ~QDockWidget () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QDockWidget > pq; +} QGC_POINTER_QDockWidget; + QT_G_FUNC( release_QDockWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QDockWidget * p = ( QGC_POINTER_QDockWidget * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDockWidget p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QDockWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QDockWidget * ) ph )->~QDockWidget(); - ph = NULL; + ( ( QDockWidget * ) p->ph )->~QDockWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDockWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDockWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDockWidget Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QDockWidget" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDockWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDockWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDockWidget" ); + #endif } } +void * gcAllocate_QDockWidget( void * pObj ) +{ + QGC_POINTER_QDockWidget * p = ( QGC_POINTER_QDockWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QDockWidget ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDockWidget; + new( & p->pq ) QPointer< QDockWidget >( ( QDockWidget * ) pObj ); + #if defined(__debug__) + just_debug( " new_QDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDOCKWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QDockWidget > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QDockWidget( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDockWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDockWidget( pObj ) ); } /* * Qt::DockWidgetAreas allowedAreas () const diff --git a/harbour/contrib/hbqt/qtgui/QDoubleSpinBox.cpp b/harbour/contrib/hbqt/qtgui/QDoubleSpinBox.cpp index bf6425ff9a..0ec14d4906 100644 --- a/harbour/contrib/hbqt/qtgui/QDoubleSpinBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QDoubleSpinBox.cpp @@ -75,52 +75,69 @@ * QDoubleSpinBox ( QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QDoubleSpinBox > pq; +} QGC_POINTER_QDoubleSpinBox; + QT_G_FUNC( release_QDoubleSpinBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDoubleSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QDoubleSpinBox * p = ( QGC_POINTER_QDoubleSpinBox * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QDoubleSpinBox p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QDoubleSpinBox ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QDoubleSpinBox * ) ph )->~QDoubleSpinBox(); - ph = NULL; + ( ( QDoubleSpinBox * ) p->ph )->~QDoubleSpinBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QDoubleSpinBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QDoubleSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDoubleSpinBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDoubleSpinBox Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QDoubleSpinBox" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDoubleSpinBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QDoubleSpinBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QDoubleSpinBox" ); + #endif } } +void * gcAllocate_QDoubleSpinBox( void * pObj ) +{ + QGC_POINTER_QDoubleSpinBox * p = ( QGC_POINTER_QDoubleSpinBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QDoubleSpinBox ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QDoubleSpinBox; + new( & p->pq ) QPointer< QDoubleSpinBox >( ( QDoubleSpinBox * ) pObj ); + #if defined(__debug__) + just_debug( " new_QDoubleSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QDOUBLESPINBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QDoubleSpinBox > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QDoubleSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QDoubleSpinBox* ) new QDoubleSpinBox( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QDoubleSpinBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QDoubleSpinBox( pObj ) ); } /* * QString cleanText () const diff --git a/harbour/contrib/hbqt/qtgui/QDragEnterEvent.cpp b/harbour/contrib/hbqt/qtgui/QDragEnterEvent.cpp index f0a664d499..6b7dcceca3 100644 --- a/harbour/contrib/hbqt/qtgui/QDragEnterEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QDragEnterEvent.cpp @@ -77,31 +77,7 @@ QT_G_FUNC( release_QDragEnterEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDragEnterEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QDragEnterEvent * ) ph )->~QDragEnterEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDragEnterEvent" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDragEnterEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QDRAGENTEREVENT ) diff --git a/harbour/contrib/hbqt/qtgui/QDragLeaveEvent.cpp b/harbour/contrib/hbqt/qtgui/QDragLeaveEvent.cpp index 7cd7e2ba9a..e3bac119a9 100644 --- a/harbour/contrib/hbqt/qtgui/QDragLeaveEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QDragLeaveEvent.cpp @@ -77,31 +77,7 @@ QT_G_FUNC( release_QDragLeaveEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDragLeaveEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QDragLeaveEvent * ) ph )->~QDragLeaveEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QDragLeaveEvent" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDragLeaveEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QDRAGLEAVEEVENT ) diff --git a/harbour/contrib/hbqt/qtgui/QDragMoveEvent.cpp b/harbour/contrib/hbqt/qtgui/QDragMoveEvent.cpp index 8e7522a0eb..f21801c8f9 100644 --- a/harbour/contrib/hbqt/qtgui/QDragMoveEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QDragMoveEvent.cpp @@ -78,21 +78,7 @@ QT_G_FUNC( release_QDragMoveEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDragMoveEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - ( ( QDragMoveEvent * ) ph )->~QDragMoveEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDragMoveEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QDRAGMOVEEVENT ) @@ -119,7 +105,7 @@ HB_FUNC( QT_QDRAGMOVEEVENT_ACCEPT_1 ) */ HB_FUNC( QT_QDRAGMOVEEVENT_ANSWERRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QDragMoveEvent( 1 )->answerRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QDragMoveEvent( 1 )->answerRect() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDropEvent.cpp b/harbour/contrib/hbqt/qtgui/QDropEvent.cpp index dad1b5e976..48cd3aa95f 100644 --- a/harbour/contrib/hbqt/qtgui/QDropEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QDropEvent.cpp @@ -77,21 +77,7 @@ QT_G_FUNC( release_QDropEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QDropEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - ( ( QDropEvent * ) ph )->~QDropEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QDropEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QDROPEVENT ) @@ -142,7 +128,7 @@ HB_FUNC( QT_QDROPEVENT_MOUSEBUTTONS ) */ HB_FUNC( QT_QDROPEVENT_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QDropEvent( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QDropEvent( 1 )->pos() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QErrorMessage.cpp b/harbour/contrib/hbqt/qtgui/QErrorMessage.cpp index 121e3158ea..9808da90cb 100644 --- a/harbour/contrib/hbqt/qtgui/QErrorMessage.cpp +++ b/harbour/contrib/hbqt/qtgui/QErrorMessage.cpp @@ -85,52 +85,69 @@ * ~QErrorMessage () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QErrorMessage > pq; +} QGC_POINTER_QErrorMessage; + QT_G_FUNC( release_QErrorMessage ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QErrorMessage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QErrorMessage * p = ( QGC_POINTER_QErrorMessage * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QErrorMessage p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QErrorMessage ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QErrorMessage * ) ph )->~QErrorMessage(); - ph = NULL; + ( ( QErrorMessage * ) p->ph )->~QErrorMessage(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QErrorMessage Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QErrorMessage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QErrorMessage" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QErrorMessage Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QErrorMessage" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QErrorMessage" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QErrorMessage Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QErrorMessage" ); + #endif } } +void * gcAllocate_QErrorMessage( void * pObj ) +{ + QGC_POINTER_QErrorMessage * p = ( QGC_POINTER_QErrorMessage * ) hb_gcAllocate( sizeof( QGC_POINTER_QErrorMessage ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QErrorMessage; + new( & p->pq ) QPointer< QErrorMessage >( ( QErrorMessage * ) pObj ); + #if defined(__debug__) + just_debug( " new_QErrorMessage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QERRORMESSAGE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QErrorMessage > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QErrorMessage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QErrorMessage* ) new QErrorMessage( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QErrorMessage; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QErrorMessage( pObj ) ); } /* * void showMessage ( const QString & message, const QString & type ) diff --git a/harbour/contrib/hbqt/qtgui/QFileDialog.cpp b/harbour/contrib/hbqt/qtgui/QFileDialog.cpp index e7811f0062..cfe42e00cd 100644 --- a/harbour/contrib/hbqt/qtgui/QFileDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QFileDialog.cpp @@ -103,42 +103,65 @@ * ~QFileDialog () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFileDialog > pq; +} QGC_POINTER_QFileDialog; + QT_G_FUNC( release_QFileDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFileDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFileDialog * p = ( QGC_POINTER_QFileDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFileDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFileDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFileDialog * ) ph )->~QFileDialog(); - ph = NULL; + ( ( QFileDialog * ) p->ph )->~QFileDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFileDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFileDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFileDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFileDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFileDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFileDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFileDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFileDialog" ); + #endif } } +void * gcAllocate_QFileDialog( void * pObj ) +{ + QGC_POINTER_QFileDialog * p = ( QGC_POINTER_QFileDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QFileDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFileDialog; + new( & p->pq ) QPointer< QFileDialog >( ( QFileDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFileDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFILEDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFileDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFileDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -153,13 +176,7 @@ hb_snprintf( str, sizeof(str), " GC: new QFileDialog %i B %i pObj = new QFileDialog() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFileDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFileDialog( pObj ) ); } /* * AcceptMode acceptMode () const @@ -190,7 +207,7 @@ HB_FUNC( QT_QFILEDIALOG_DEFAULTSUFFIX ) */ HB_FUNC( QT_QFILEDIALOG_DIRECTORY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDir( hbqt_par_QFileDialog( 1 )->directory() ), release_QDir ) ); + hb_retptrGC( gcAllocate_QDir( new QDir( hbqt_par_QFileDialog( 1 )->directory() ) ) ); } /* @@ -214,7 +231,7 @@ HB_FUNC( QT_QFILEDIALOG_FILTER ) */ HB_FUNC( QT_QFILEDIALOG_HISTORY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFileDialog( 1 )->history() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->history() ) ) ); } /* @@ -262,7 +279,7 @@ HB_FUNC( QT_QFILEDIALOG_LABELTEXT ) */ HB_FUNC( QT_QFILEDIALOG_NAMEFILTERS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFileDialog( 1 )->nameFilters() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->nameFilters() ) ) ); } /* @@ -302,7 +319,7 @@ HB_FUNC( QT_QFILEDIALOG_RESTORESTATE ) */ HB_FUNC( QT_QFILEDIALOG_SAVESTATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QFileDialog( 1 )->saveState() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QFileDialog( 1 )->saveState() ) ) ); } /* @@ -326,7 +343,7 @@ HB_FUNC( QT_QFILEDIALOG_SELECTNAMEFILTER ) */ HB_FUNC( QT_QFILEDIALOG_SELECTEDFILES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFileDialog( 1 )->selectedFiles() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->selectedFiles() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFileIconProvider.cpp b/harbour/contrib/hbqt/qtgui/QFileIconProvider.cpp index 82840b2789..922c97ba6e 100644 --- a/harbour/contrib/hbqt/qtgui/QFileIconProvider.cpp +++ b/harbour/contrib/hbqt/qtgui/QFileIconProvider.cpp @@ -81,47 +81,55 @@ QT_G_FUNC( release_QFileIconProvider ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFileIconProvider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFileIconProvider p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QFileIconProvider ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QFileIconProvider * ) ph )->~QFileIconProvider(); - ph = NULL; + ( ( QFileIconProvider * ) p->ph )->~QFileIconProvider(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFileIconProvider Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFileIconProvider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFileIconProvider" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFileIconProvider Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFileIconProvider" ); + #endif } } +void * gcAllocate_QFileIconProvider( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFileIconProvider; + #if defined(__debug__) + just_debug( " new_QFileIconProvider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFILEICONPROVIDER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFileIconProvider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QFileIconProvider() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFileIconProvider; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFileIconProvider( pObj ) ); } /* * virtual QIcon icon ( IconType type ) const */ HB_FUNC( QT_QFILEICONPROVIDER_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QFileIconProvider( 1 )->icon( ( QFileIconProvider::IconType ) hb_parni( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QFileIconProvider( 1 )->icon( ( QFileIconProvider::IconType ) hb_parni( 2 ) ) ) ) ); } /* @@ -129,7 +137,7 @@ HB_FUNC( QT_QFILEICONPROVIDER_ICON ) */ HB_FUNC( QT_QFILEICONPROVIDER_ICON_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QFileIconProvider( 1 )->icon( *hbqt_par_QFileInfo( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QFileIconProvider( 1 )->icon( *hbqt_par_QFileInfo( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFileSystemModel.cpp b/harbour/contrib/hbqt/qtgui/QFileSystemModel.cpp index caef05bc6b..483268f1f1 100644 --- a/harbour/contrib/hbqt/qtgui/QFileSystemModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QFileSystemModel.cpp @@ -80,52 +80,69 @@ * ~QFileSystemModel () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFileSystemModel > pq; +} QGC_POINTER_QFileSystemModel; + QT_G_FUNC( release_QFileSystemModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFileSystemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFileSystemModel * p = ( QGC_POINTER_QFileSystemModel * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFileSystemModel p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFileSystemModel ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFileSystemModel * ) ph )->~QFileSystemModel(); - ph = NULL; + ( ( QFileSystemModel * ) p->ph )->~QFileSystemModel(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFileSystemModel Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFileSystemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFileSystemModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFileSystemModel Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFileSystemModel" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFileSystemModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFileSystemModel Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFileSystemModel" ); + #endif } } +void * gcAllocate_QFileSystemModel( void * pObj ) +{ + QGC_POINTER_QFileSystemModel * p = ( QGC_POINTER_QFileSystemModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QFileSystemModel ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFileSystemModel; + new( & p->pq ) QPointer< QFileSystemModel >( ( QFileSystemModel * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFileSystemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFILESYSTEMMODEL ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFileSystemModel > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFileSystemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QFileSystemModel * ) new QFileSystemModel() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFileSystemModel; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFileSystemModel( pObj ) ); } /* * virtual bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ) @@ -140,7 +157,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_DROPMIMEDATA ) */ HB_FUNC( QT_QFILESYSTEMMODEL_FILEICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QFileSystemModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QFileSystemModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -148,7 +165,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_FILEICON ) */ HB_FUNC( QT_QFILESYSTEMMODEL_FILEINFO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFileInfo( hbqt_par_QFileSystemModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ), release_QFileInfo ) ); + hb_retptrGC( gcAllocate_QFileInfo( new QFileInfo( hbqt_par_QFileSystemModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -180,7 +197,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_FILTER ) */ HB_FUNC( QT_QFILESYSTEMMODEL_INDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->index( hbqt_par_QString( 2 ), hb_parni( 3 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->index( hbqt_par_QString( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -204,7 +221,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_ISREADONLY ) */ HB_FUNC( QT_QFILESYSTEMMODEL_LASTMODIFIED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QFileSystemModel( 1 )->lastModified( *hbqt_par_QModelIndex( 2 ) ) ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileSystemModel( 1 )->lastModified( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -212,7 +229,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_LASTMODIFIED ) */ HB_FUNC( QT_QFILESYSTEMMODEL_MIMETYPES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFileSystemModel( 1 )->mimeTypes() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFileSystemModel( 1 )->mimeTypes() ) ) ); } /* @@ -220,7 +237,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_MIMETYPES ) */ HB_FUNC( QT_QFILESYSTEMMODEL_MKDIR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), hbqt_par_QString( 3 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), hbqt_par_QString( 3 ) ) ) ) ); } /* @@ -228,7 +245,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_MKDIR ) */ HB_FUNC( QT_QFILESYSTEMMODEL_MYCOMPUTER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QFileSystemModel( 1 )->myComputer( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::DisplayRole ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QFileSystemModel( 1 )->myComputer( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::DisplayRole ) ) ) ) ); } /* @@ -244,7 +261,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_NAMEFILTERDISABLES ) */ HB_FUNC( QT_QFILESYSTEMMODEL_NAMEFILTERS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFileSystemModel( 1 )->nameFilters() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFileSystemModel( 1 )->nameFilters() ) ) ); } /* @@ -284,7 +301,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_RMDIR ) */ HB_FUNC( QT_QFILESYSTEMMODEL_ROOTDIRECTORY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDir( hbqt_par_QFileSystemModel( 1 )->rootDirectory() ), release_QDir ) ); + hb_retptrGC( gcAllocate_QDir( new QDir( hbqt_par_QFileSystemModel( 1 )->rootDirectory() ) ) ); } /* @@ -340,7 +357,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_SETRESOLVESYMLINKS ) */ HB_FUNC( QT_QFILESYSTEMMODEL_SETROOTPATH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->setRootPath( hbqt_par_QString( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->setRootPath( hbqt_par_QString( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFocusEvent.cpp b/harbour/contrib/hbqt/qtgui/QFocusEvent.cpp index 964a880a79..e54ae66797 100644 --- a/harbour/contrib/hbqt/qtgui/QFocusEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QFocusEvent.cpp @@ -77,31 +77,7 @@ QT_G_FUNC( release_QFocusEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFocusEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QFocusEvent * ) ph )->~QFocusEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFocusEvent" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFocusEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QFOCUSEVENT ) diff --git a/harbour/contrib/hbqt/qtgui/QFocusFrame.cpp b/harbour/contrib/hbqt/qtgui/QFocusFrame.cpp index 3c9266f067..34d9da14c7 100644 --- a/harbour/contrib/hbqt/qtgui/QFocusFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QFocusFrame.cpp @@ -76,52 +76,69 @@ * ~QFocusFrame () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFocusFrame > pq; +} QGC_POINTER_QFocusFrame; + QT_G_FUNC( release_QFocusFrame ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFocusFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFocusFrame * p = ( QGC_POINTER_QFocusFrame * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFocusFrame p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFocusFrame ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFocusFrame * ) ph )->~QFocusFrame(); - ph = NULL; + ( ( QFocusFrame * ) p->ph )->~QFocusFrame(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFocusFrame Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFocusFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFocusFrame" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFocusFrame Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFocusFrame" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFocusFrame" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFocusFrame Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFocusFrame" ); + #endif } } +void * gcAllocate_QFocusFrame( void * pObj ) +{ + QGC_POINTER_QFocusFrame * p = ( QGC_POINTER_QFocusFrame * ) hb_gcAllocate( sizeof( QGC_POINTER_QFocusFrame ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFocusFrame; + new( & p->pq ) QPointer< QFocusFrame >( ( QFocusFrame * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFocusFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFOCUSFRAME ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFocusFrame > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFocusFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QFocusFrame* ) new QFocusFrame( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFocusFrame; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFocusFrame( pObj ) ); } /* * void setWidget ( QWidget * widget ) diff --git a/harbour/contrib/hbqt/qtgui/QFont.cpp b/harbour/contrib/hbqt/qtgui/QFont.cpp index 2b513cd518..7f482346f2 100644 --- a/harbour/contrib/hbqt/qtgui/QFont.cpp +++ b/harbour/contrib/hbqt/qtgui/QFont.cpp @@ -91,30 +91,44 @@ QT_G_FUNC( release_QFont ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFont %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFont p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QFont ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QFont * ) ph )->~QFont(); - ph = NULL; + ( ( QFont * ) p->ph )->~QFont(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFont Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFont %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFont" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFont Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFont" ); + #endif } } +void * gcAllocate_QFont( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFont; + #if defined(__debug__) + just_debug( " new_QFont %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFONT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFont %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) { @@ -145,13 +159,7 @@ hb_snprintf( str, sizeof(str), " GC: new QFont %i B %i pObj = ( QFont* ) new QFont() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFont; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFont( pObj ) ); } /* * bool bold () const @@ -606,7 +614,7 @@ HB_FUNC( QT_QFONT_SUBSTITUTE ) */ HB_FUNC( QT_QFONT_SUBSTITUTES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFont( 1 )->substitutes( hbqt_par_QString( 2 ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFont( 1 )->substitutes( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -614,7 +622,7 @@ HB_FUNC( QT_QFONT_SUBSTITUTES ) */ HB_FUNC( QT_QFONT_SUBSTITUTIONS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFont( 1 )->substitutions() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFont( 1 )->substitutions() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QFontComboBox.cpp b/harbour/contrib/hbqt/qtgui/QFontComboBox.cpp index 4358f7d3a3..8311d49fb2 100644 --- a/harbour/contrib/hbqt/qtgui/QFontComboBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontComboBox.cpp @@ -81,59 +81,76 @@ * ~QFontComboBox () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFontComboBox > pq; +} QGC_POINTER_QFontComboBox; + QT_G_FUNC( release_QFontComboBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFontComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFontComboBox * p = ( QGC_POINTER_QFontComboBox * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFontComboBox p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFontComboBox ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFontComboBox * ) ph )->~QFontComboBox(); - ph = NULL; + ( ( QFontComboBox * ) p->ph )->~QFontComboBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFontComboBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFontComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFontComboBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFontComboBox Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFontComboBox" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFontComboBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFontComboBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFontComboBox" ); + #endif } } +void * gcAllocate_QFontComboBox( void * pObj ) +{ + QGC_POINTER_QFontComboBox * p = ( QGC_POINTER_QFontComboBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QFontComboBox ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFontComboBox; + new( & p->pq ) QPointer< QFontComboBox >( ( QFontComboBox * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFontComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFONTCOMBOBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFontComboBox > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFontComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QFontComboBox * ) new QFontComboBox( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFontComboBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFontComboBox( pObj ) ); } /* * QFont currentFont () const */ HB_FUNC( QT_QFONTCOMBOBOX_CURRENTFONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontComboBox( 1 )->currentFont() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontComboBox( 1 )->currentFont() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFontDatabase.cpp b/harbour/contrib/hbqt/qtgui/QFontDatabase.cpp index 3617fdbc46..9ad0b6f264 100644 --- a/harbour/contrib/hbqt/qtgui/QFontDatabase.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontDatabase.cpp @@ -95,40 +95,48 @@ QT_G_FUNC( release_QFontDatabase ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFontDatabase %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDatabase p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDatabase ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QFontDatabase * ) ph )->~QFontDatabase(); - ph = NULL; + ( ( QFontDatabase * ) p->ph )->~QFontDatabase(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDatabase Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFontDatabase %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFontDatabase" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDatabase Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFontDatabase" ); + #endif } } +void * gcAllocate_QFontDatabase( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFontDatabase; + #if defined(__debug__) + just_debug( " new_QFontDatabase %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFONTDATABASE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFontDatabase %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QFontDatabase() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFontDatabase; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFontDatabase( pObj ) ); } /* * bool bold ( const QString & family, const QString & style ) const @@ -143,7 +151,7 @@ HB_FUNC( QT_QFONTDATABASE_BOLD ) */ HB_FUNC( QT_QFONTDATABASE_FAMILIES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFontDatabase( 1 )->families( ( HB_ISNUM( 2 ) ? ( QFontDatabase::WritingSystem ) hb_parni( 2 ) : ( QFontDatabase::WritingSystem ) QFontDatabase::Any ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->families( ( HB_ISNUM( 2 ) ? ( QFontDatabase::WritingSystem ) hb_parni( 2 ) : ( QFontDatabase::WritingSystem ) QFontDatabase::Any ) ) ) ) ); } /* @@ -151,7 +159,7 @@ HB_FUNC( QT_QFONTDATABASE_FAMILIES ) */ HB_FUNC( QT_QFONTDATABASE_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontDatabase( 1 )->font( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontDatabase( 1 )->font( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ) ) ) ) ); } /* @@ -215,7 +223,7 @@ HB_FUNC( QT_QFONTDATABASE_STYLESTRING_1 ) */ HB_FUNC( QT_QFONTDATABASE_STYLES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFontDatabase( 1 )->styles( hbqt_par_QString( 2 ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->styles( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -247,7 +255,7 @@ HB_FUNC( QT_QFONTDATABASE_ADDAPPLICATIONFONTFROMDATA ) */ HB_FUNC( QT_QFONTDATABASE_APPLICATIONFONTFAMILIES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QFontDatabase( 1 )->applicationFontFamilies( hb_parni( 2 ) ) ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->applicationFontFamilies( hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFontDialog.cpp b/harbour/contrib/hbqt/qtgui/QFontDialog.cpp index 5ae35fcb8f..d1f9f7af48 100644 --- a/harbour/contrib/hbqt/qtgui/QFontDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontDialog.cpp @@ -81,42 +81,65 @@ * QFontDialog ( const QFont & initial, QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFontDialog > pq; +} QGC_POINTER_QFontDialog; + QT_G_FUNC( release_QFontDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFontDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFontDialog * p = ( QGC_POINTER_QFontDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFontDialog * ) ph )->~QFontDialog(); - ph = NULL; + ( ( QFontDialog * ) p->ph )->~QFontDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFontDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFontDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFontDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFontDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFontDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFontDialog" ); + #endif } } +void * gcAllocate_QFontDialog( void * pObj ) +{ + QGC_POINTER_QFontDialog * p = ( QGC_POINTER_QFontDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QFontDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFontDialog; + new( & p->pq ) QPointer< QFontDialog >( ( QFontDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFontDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFONTDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFontDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFontDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -131,20 +154,14 @@ hb_snprintf( str, sizeof(str), " GC: new QFontDialog %i B %i pObj = new QFontDialog( 0 ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFontDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFontDialog( pObj ) ); } /* * QFont currentFont () const */ HB_FUNC( QT_QFONTDIALOG_CURRENTFONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontDialog( 1 )->currentFont() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->currentFont() ) ) ); } /* @@ -160,7 +177,7 @@ HB_FUNC( QT_QFONTDIALOG_OPTIONS ) */ HB_FUNC( QT_QFONTDIALOG_SELECTEDFONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontDialog( 1 )->selectedFont() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->selectedFont() ) ) ); } /* @@ -202,7 +219,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT ) { bool iOk = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), hbqt_par_QString( 5 ), ( QFontDialog::FontDialogOptions ) hb_parni( 6 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), hbqt_par_QString( 5 ), ( QFontDialog::FontDialogOptions ) hb_parni( 6 ) ) ) ) ); hb_stornl( iOk, 2 ); } @@ -214,7 +231,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT_1 ) { bool iOk = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), hbqt_par_char( 5 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), hbqt_par_char( 5 ) ) ) ) ); hb_stornl( iOk, 2 ); } @@ -226,7 +243,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT_2 ) { bool iOk = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), hbqt_par_QString( 5 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), hbqt_par_QString( 5 ) ) ) ) ); hb_stornl( iOk, 2 ); } @@ -238,7 +255,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT_3 ) { bool iOk = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ) ) ) ) ); hb_stornl( iOk, 2 ); } @@ -250,7 +267,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT_4 ) { bool iOk = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, hbqt_par_QWidget( 3 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, hbqt_par_QWidget( 3 ) ) ) ) ); hb_stornl( iOk, 2 ); } diff --git a/harbour/contrib/hbqt/qtgui/QFontInfo.cpp b/harbour/contrib/hbqt/qtgui/QFontInfo.cpp index e8dc4c5c39..0940d9c6c6 100644 --- a/harbour/contrib/hbqt/qtgui/QFontInfo.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontInfo.cpp @@ -79,30 +79,44 @@ QT_G_FUNC( release_QFontInfo ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFontInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFontInfo p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QFontInfo ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QFontInfo * ) ph )->~QFontInfo(); - ph = NULL; + ( ( QFontInfo * ) p->ph )->~QFontInfo(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFontInfo Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFontInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFontInfo" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFontInfo Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFontInfo" ); + #endif } } +void * gcAllocate_QFontInfo( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFontInfo; + #if defined(__debug__) + just_debug( " new_QFontInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFONTINFO ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFontInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -113,13 +127,7 @@ hb_snprintf( str, sizeof(str), " GC: new QFontInfo %i B %i pObj = new QFontInfo( *hbqt_par_QFont( 2 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFontInfo; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFontInfo( pObj ) ); } /* * bool bold () const diff --git a/harbour/contrib/hbqt/qtgui/QFontMetrics.cpp b/harbour/contrib/hbqt/qtgui/QFontMetrics.cpp index 8a85a6ba0c..06fd248b24 100644 --- a/harbour/contrib/hbqt/qtgui/QFontMetrics.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontMetrics.cpp @@ -80,30 +80,44 @@ QT_G_FUNC( release_QFontMetrics ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFontMetrics %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFontMetrics p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QFontMetrics ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QFontMetrics * ) ph )->~QFontMetrics(); - ph = NULL; + ( ( QFontMetrics * ) p->ph )->~QFontMetrics(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFontMetrics Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFontMetrics %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFontMetrics" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFontMetrics Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFontMetrics" ); + #endif } } +void * gcAllocate_QFontMetrics( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFontMetrics; + #if defined(__debug__) + just_debug( " new_QFontMetrics %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFONTMETRICS ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFontMetrics %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -121,13 +135,7 @@ hb_snprintf( str, sizeof(str), " GC: new QFontMetrics %i B %i pObj = new QFontMetrics( *hbqt_par_QFont( 1 ), hbqt_par_QPaintDevice( 2 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFontMetrics; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFontMetrics( pObj ) ); } /* * int ascent () const @@ -150,7 +158,7 @@ HB_FUNC( QT_QFONTMETRICS_AVERAGECHARWIDTH ) */ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hb_parni( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hb_parni( 2 ) ) ) ) ); } /* @@ -158,7 +166,7 @@ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT ) */ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hbqt_par_QString( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -168,7 +176,7 @@ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT_2 ) { int iTabArray = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hbqt_par_QString( 7 ), hb_parni( 8 ), &iTabArray ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hbqt_par_QString( 7 ), hb_parni( 8 ), &iTabArray ) ) ) ); hb_storni( iTabArray, 9 ); } @@ -180,7 +188,7 @@ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT_3 ) { int iTabArray = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ), hb_parni( 5 ), &iTabArray ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ), hb_parni( 5 ), &iTabArray ) ) ) ); hb_storni( iTabArray, 6 ); } @@ -296,7 +304,7 @@ HB_FUNC( QT_QFONTMETRICS_SIZE ) { int iTabArray = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QFontMetrics( 1 )->size( hb_parni( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ), &iTabArray ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QFontMetrics( 1 )->size( hb_parni( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ), &iTabArray ) ) ) ); hb_storni( iTabArray, 5 ); } @@ -314,7 +322,7 @@ HB_FUNC( QT_QFONTMETRICS_STRIKEOUTPOS ) */ HB_FUNC( QT_QFONTMETRICS_TIGHTBOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QFontMetrics( 1 )->tightBoundingRect( hbqt_par_QString( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->tightBoundingRect( hbqt_par_QString( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFontMetricsF.cpp b/harbour/contrib/hbqt/qtgui/QFontMetricsF.cpp index 9930270ada..40d2b66006 100644 --- a/harbour/contrib/hbqt/qtgui/QFontMetricsF.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontMetricsF.cpp @@ -81,30 +81,44 @@ QT_G_FUNC( release_QFontMetricsF ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFontMetricsF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFontMetricsF p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QFontMetricsF ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QFontMetricsF * ) ph )->~QFontMetricsF(); - ph = NULL; + ( ( QFontMetricsF * ) p->ph )->~QFontMetricsF(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFontMetricsF Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFontMetricsF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFontMetricsF" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFontMetricsF Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFontMetricsF" ); + #endif } } +void * gcAllocate_QFontMetricsF( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFontMetricsF; + #if defined(__debug__) + just_debug( " new_QFontMetricsF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFONTMETRICSF ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFontMetricsF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -126,13 +140,7 @@ hb_snprintf( str, sizeof(str), " GC: new QFontMetricsF %i B %i pObj = ( QFontMetricsF* ) new QFontMetricsF( *hbqt_par_QFont( 1 ), hbqt_par_QPaintDevice( 2 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFontMetricsF; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFontMetricsF( pObj ) ); } /* * qreal ascent () const @@ -155,7 +163,7 @@ HB_FUNC( QT_QFONTMETRICSF_AVERAGECHARWIDTH ) */ HB_FUNC( QT_QFONTMETRICSF_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( hbqt_par_QString( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -163,7 +171,7 @@ HB_FUNC( QT_QFONTMETRICSF_BOUNDINGRECT ) */ HB_FUNC( QT_QFONTMETRICSF_BOUNDINGRECT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( hb_parni( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( hb_parni( 2 ) ) ) ) ); } /* @@ -173,7 +181,7 @@ HB_FUNC( QT_QFONTMETRICSF_BOUNDINGRECT_2 ) { int iTabArray = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ), hb_parni( 5 ), &iTabArray ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ), hb_parni( 5 ), &iTabArray ) ) ) ); hb_storni( iTabArray, 6 ); } @@ -289,7 +297,7 @@ HB_FUNC( QT_QFONTMETRICSF_SIZE ) { int iTabArray = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QFontMetricsF( 1 )->size( hb_parni( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ), &iTabArray ) ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QFontMetricsF( 1 )->size( hb_parni( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ), &iTabArray ) ) ) ); hb_storni( iTabArray, 5 ); } @@ -307,7 +315,7 @@ HB_FUNC( QT_QFONTMETRICSF_STRIKEOUTPOS ) */ HB_FUNC( QT_QFONTMETRICSF_TIGHTBOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QFontMetricsF( 1 )->tightBoundingRect( hbqt_par_QString( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->tightBoundingRect( hbqt_par_QString( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFormLayout.cpp b/harbour/contrib/hbqt/qtgui/QFormLayout.cpp index df4ead991e..f0b0205675 100644 --- a/harbour/contrib/hbqt/qtgui/QFormLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QFormLayout.cpp @@ -82,52 +82,69 @@ * ~QFormLayout () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFormLayout > pq; +} QGC_POINTER_QFormLayout; + QT_G_FUNC( release_QFormLayout ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFormLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFormLayout * p = ( QGC_POINTER_QFormLayout * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFormLayout p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFormLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFormLayout * ) ph )->~QFormLayout(); - ph = NULL; + ( ( QFormLayout * ) p->ph )->~QFormLayout(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFormLayout Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFormLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFormLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFormLayout Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFormLayout" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFormLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFormLayout Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFormLayout" ); + #endif } } +void * gcAllocate_QFormLayout( void * pObj ) +{ + QGC_POINTER_QFormLayout * p = ( QGC_POINTER_QFormLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QFormLayout ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFormLayout; + new( & p->pq ) QPointer< QFormLayout >( ( QFormLayout * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFormLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFORMLAYOUT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFormLayout > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFormLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QFormLayout * ) new QFormLayout( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFormLayout; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFormLayout( pObj ) ); } /* * void addRow ( QWidget * label, QWidget * field ) diff --git a/harbour/contrib/hbqt/qtgui/QFrame.cpp b/harbour/contrib/hbqt/qtgui/QFrame.cpp index d698b53c92..4c3add036d 100644 --- a/harbour/contrib/hbqt/qtgui/QFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QFrame.cpp @@ -82,59 +82,76 @@ * ~QFrame () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFrame > pq; +} QGC_POINTER_QFrame; + QT_G_FUNC( release_QFrame ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFrame * p = ( QGC_POINTER_QFrame * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFrame p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFrame ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFrame * ) ph )->~QFrame(); - ph = NULL; + ( ( QFrame * ) p->ph )->~QFrame(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFrame Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFrame" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFrame Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFrame" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFrame" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFrame Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFrame" ); + #endif } } +void * gcAllocate_QFrame( void * pObj ) +{ + QGC_POINTER_QFrame * p = ( QGC_POINTER_QFrame * ) hb_gcAllocate( sizeof( QGC_POINTER_QFrame ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFrame; + new( & p->pq ) QPointer< QFrame >( ( QFrame * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFRAME ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFrame > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QFrame( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFrame; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFrame( pObj ) ); } /* * QRect frameRect () const */ HB_FUNC( QT_QFRAME_FRAMERECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QFrame( 1 )->frameRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QFrame( 1 )->frameRect() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QGradient.cpp b/harbour/contrib/hbqt/qtgui/QGradient.cpp index 13184c3a59..983a9bf477 100644 --- a/harbour/contrib/hbqt/qtgui/QGradient.cpp +++ b/harbour/contrib/hbqt/qtgui/QGradient.cpp @@ -83,31 +83,7 @@ QT_G_FUNC( release_QGradient ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QGradient * ) ph )->~QGradient(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QGradient" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QGradient" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QGRADIENT ) diff --git a/harbour/contrib/hbqt/qtgui/QGridLayout.cpp b/harbour/contrib/hbqt/qtgui/QGridLayout.cpp index 945ef2d273..7b965dc135 100644 --- a/harbour/contrib/hbqt/qtgui/QGridLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QGridLayout.cpp @@ -77,52 +77,69 @@ * ~QGridLayout () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QGridLayout > pq; +} QGC_POINTER_QGridLayout; + QT_G_FUNC( release_QGridLayout ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QGridLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QGridLayout * p = ( QGC_POINTER_QGridLayout * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QGridLayout p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QGridLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QGridLayout * ) ph )->~QGridLayout(); - ph = NULL; + ( ( QGridLayout * ) p->ph )->~QGridLayout(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QGridLayout Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QGridLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QGridLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QGridLayout Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QGridLayout" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QGridLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QGridLayout Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QGridLayout" ); + #endif } } +void * gcAllocate_QGridLayout( void * pObj ) +{ + QGC_POINTER_QGridLayout * p = ( QGC_POINTER_QGridLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QGridLayout ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QGridLayout; + new( & p->pq ) QPointer< QGridLayout >( ( QGridLayout * ) pObj ); + #if defined(__debug__) + just_debug( " new_QGridLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QGRIDLAYOUT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QGridLayout > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QGridLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QGridLayout( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QGridLayout; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QGridLayout( pObj ) ); } /* * void addItem ( QLayoutItem * item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = 0 ) @@ -169,7 +186,7 @@ HB_FUNC( QT_QGRIDLAYOUT_ADDWIDGET_1 ) */ HB_FUNC( QT_QGRIDLAYOUT_CELLRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QGridLayout( 1 )->cellRect( hb_parni( 2 ), hb_parni( 3 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QGridLayout( 1 )->cellRect( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QGroupBox.cpp b/harbour/contrib/hbqt/qtgui/QGroupBox.cpp index efdc6dacf6..a0eb3efcbd 100644 --- a/harbour/contrib/hbqt/qtgui/QGroupBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QGroupBox.cpp @@ -77,52 +77,69 @@ * ~QGroupBox () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QGroupBox > pq; +} QGC_POINTER_QGroupBox; + QT_G_FUNC( release_QGroupBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QGroupBox * p = ( QGC_POINTER_QGroupBox * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QGroupBox p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QGroupBox ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QGroupBox * ) ph )->~QGroupBox(); - ph = NULL; + ( ( QGroupBox * ) p->ph )->~QGroupBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QGroupBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QGroupBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QGroupBox Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QGroupBox" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QGroupBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QGroupBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QGroupBox" ); + #endif } } +void * gcAllocate_QGroupBox( void * pObj ) +{ + QGC_POINTER_QGroupBox * p = ( QGC_POINTER_QGroupBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QGroupBox ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QGroupBox; + new( & p->pq ) QPointer< QGroupBox >( ( QGroupBox * ) pObj ); + #if defined(__debug__) + just_debug( " new_QGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QGROUPBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QGroupBox > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QGroupBox * ) new QGroupBox( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QGroupBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QGroupBox( pObj ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QHBoxLayout.cpp b/harbour/contrib/hbqt/qtgui/QHBoxLayout.cpp index 41a94b10a9..89c49ff014 100644 --- a/harbour/contrib/hbqt/qtgui/QHBoxLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QHBoxLayout.cpp @@ -77,52 +77,69 @@ * ~QHBoxLayout () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QHBoxLayout > pq; +} QGC_POINTER_QHBoxLayout; + QT_G_FUNC( release_QHBoxLayout ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QHBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QHBoxLayout * p = ( QGC_POINTER_QHBoxLayout * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QHBoxLayout p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QHBoxLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QHBoxLayout * ) ph )->~QHBoxLayout(); - ph = NULL; + ( ( QHBoxLayout * ) p->ph )->~QHBoxLayout(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QHBoxLayout Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QHBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QHBoxLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QHBoxLayout Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QHBoxLayout" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QHBoxLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QHBoxLayout Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QHBoxLayout" ); + #endif } } +void * gcAllocate_QHBoxLayout( void * pObj ) +{ + QGC_POINTER_QHBoxLayout * p = ( QGC_POINTER_QHBoxLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QHBoxLayout ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QHBoxLayout; + new( & p->pq ) QPointer< QHBoxLayout >( ( QHBoxLayout * ) pObj ); + #if defined(__debug__) + just_debug( " new_QHBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QHBOXLAYOUT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QHBoxLayout > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QHBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QHBoxLayout * ) new QHBoxLayout( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QHBoxLayout; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QHBoxLayout( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QHeaderView.cpp b/harbour/contrib/hbqt/qtgui/QHeaderView.cpp index 87bd965d74..c06094cbd6 100644 --- a/harbour/contrib/hbqt/qtgui/QHeaderView.cpp +++ b/harbour/contrib/hbqt/qtgui/QHeaderView.cpp @@ -80,52 +80,69 @@ * virtual ~QHeaderView () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QHeaderView > pq; +} QGC_POINTER_QHeaderView; + QT_G_FUNC( release_QHeaderView ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QHeaderView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QHeaderView * p = ( QGC_POINTER_QHeaderView * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QHeaderView p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QHeaderView ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QHeaderView * ) ph )->~QHeaderView(); - ph = NULL; + ( ( QHeaderView * ) p->ph )->~QHeaderView(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QHeaderView Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QHeaderView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QHeaderView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QHeaderView Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QHeaderView" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QHeaderView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QHeaderView Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QHeaderView" ); + #endif } } +void * gcAllocate_QHeaderView( void * pObj ) +{ + QGC_POINTER_QHeaderView * p = ( QGC_POINTER_QHeaderView * ) hb_gcAllocate( sizeof( QGC_POINTER_QHeaderView ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QHeaderView; + new( & p->pq ) QPointer< QHeaderView >( ( QHeaderView * ) pObj ); + #if defined(__debug__) + just_debug( " new_QHeaderView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QHEADERVIEW ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QHeaderView > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QHeaderView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QHeaderView( ( Qt::Orientation ) hb_parni( 1 ), hbqt_par_QWidget( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QHeaderView; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QHeaderView( pObj ) ); } /* * bool cascadingSectionResizes () const @@ -324,7 +341,7 @@ HB_FUNC( QT_QHEADERVIEW_RESTORESTATE ) */ HB_FUNC( QT_QHEADERVIEW_SAVESTATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QHeaderView( 1 )->saveState() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QHeaderView( 1 )->saveState() ) ) ); } /* @@ -492,7 +509,7 @@ HB_FUNC( QT_QHEADERVIEW_SHOWSECTION ) */ HB_FUNC( QT_QHEADERVIEW_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QHeaderView( 1 )->sizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QHeaderView( 1 )->sizeHint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QHelpEvent.cpp b/harbour/contrib/hbqt/qtgui/QHelpEvent.cpp index 2fa8488647..dea513b01c 100644 --- a/harbour/contrib/hbqt/qtgui/QHelpEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QHelpEvent.cpp @@ -77,21 +77,7 @@ QT_G_FUNC( release_QHelpEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QHelpEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - ( ( QHelpEvent * ) ph )->~QHelpEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QHelpEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QHELPEVENT ) @@ -102,7 +88,7 @@ HB_FUNC( QT_QHELPEVENT ) */ HB_FUNC( QT_QHELPEVENT_GLOBALPOS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QHelpEvent( 1 )->globalPos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QHelpEvent( 1 )->globalPos() ) ) ); } /* @@ -126,7 +112,7 @@ HB_FUNC( QT_QHELPEVENT_GLOBALY ) */ HB_FUNC( QT_QHELPEVENT_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QHelpEvent( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QHelpEvent( 1 )->pos() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QIcon.cpp b/harbour/contrib/hbqt/qtgui/QIcon.cpp index e4331e2c9a..0ee3907fba 100644 --- a/harbour/contrib/hbqt/qtgui/QIcon.cpp +++ b/harbour/contrib/hbqt/qtgui/QIcon.cpp @@ -97,30 +97,44 @@ QT_G_FUNC( release_QIcon ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QIcon p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QIcon ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QIcon * ) ph )->~QIcon(); - ph = NULL; + ( ( QIcon * ) p->ph )->~QIcon(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QIcon Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QIcon" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QIcon Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QIcon" ); + #endif } } +void * gcAllocate_QIcon( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QIcon; + #if defined(__debug__) + just_debug( " new_QIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QICON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) { @@ -135,20 +149,14 @@ hb_snprintf( str, sizeof(str), " GC: new QIcon %i B %i pObj = ( QIcon* ) new QIcon() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QIcon; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QIcon( pObj ) ); } /* * QSize actualSize ( const QSize & size, Mode mode = Normal, State state = Off ) const */ HB_FUNC( QT_QICON_ACTUALSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QIcon( 1 )->actualSize( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QIcon( 1 )->actualSize( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ) ) ); } /* @@ -204,7 +212,7 @@ HB_FUNC( QT_QICON_PAINT_1 ) */ HB_FUNC( QT_QICON_PIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ) ) ); } /* @@ -212,7 +220,7 @@ HB_FUNC( QT_QICON_PIXMAP ) */ HB_FUNC( QT_QICON_PIXMAP_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( QIcon::Mode ) hb_parni( 4 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 5 ) ? ( QIcon::State ) hb_parni( 5 ) : ( QIcon::State ) QIcon::Off ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( QIcon::Mode ) hb_parni( 4 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 5 ) ? ( QIcon::State ) hb_parni( 5 ) : ( QIcon::State ) QIcon::Off ) ) ) ) ); } /* @@ -220,7 +228,7 @@ HB_FUNC( QT_QICON_PIXMAP_1 ) */ HB_FUNC( QT_QICON_PIXMAP_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QImage.cpp b/harbour/contrib/hbqt/qtgui/QImage.cpp index 964fbb9a01..4f8a94ffbc 100644 --- a/harbour/contrib/hbqt/qtgui/QImage.cpp +++ b/harbour/contrib/hbqt/qtgui/QImage.cpp @@ -109,30 +109,44 @@ QT_G_FUNC( release_QImage ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QImage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QImage p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QImage ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QImage * ) ph )->~QImage(); - ph = NULL; + ( ( QImage * ) p->ph )->~QImage(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QImage Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QImage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QImage" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QImage Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QImage" ); + #endif } } +void * gcAllocate_QImage( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QImage; + #if defined(__debug__) + just_debug( " new_QImage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QIMAGE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QImage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -167,13 +181,7 @@ hb_snprintf( str, sizeof(str), " GC: new QImage %i B %i pObj = ( QImage* ) new QImage() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QImage; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QImage( pObj ) ); } /* * bool allGray () const @@ -188,7 +196,7 @@ HB_FUNC( QT_QIMAGE_ALLGRAY ) */ HB_FUNC( QT_QIMAGE_ALPHACHANNEL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->alphaChannel() ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->alphaChannel() ) ) ); } /* @@ -236,7 +244,7 @@ HB_FUNC( QT_QIMAGE_COLOR ) */ HB_FUNC( QT_QIMAGE_CONVERTTOFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->convertToFormat( ( QImage::Format ) hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->convertToFormat( ( QImage::Format ) hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) ) ); } /* @@ -244,7 +252,7 @@ HB_FUNC( QT_QIMAGE_CONVERTTOFORMAT ) */ HB_FUNC( QT_QIMAGE_COPY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->copy( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QRect( 2 ) : QRect() ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->copy( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QRect( 2 ) : QRect() ) ) ) ) ); } /* @@ -252,7 +260,7 @@ HB_FUNC( QT_QIMAGE_COPY ) */ HB_FUNC( QT_QIMAGE_COPY_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->copy( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->copy( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ) ) ); } /* @@ -260,7 +268,7 @@ HB_FUNC( QT_QIMAGE_COPY_1 ) */ HB_FUNC( QT_QIMAGE_CREATEALPHAMASK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->createAlphaMask( ( HB_ISNUM( 2 ) ? ( Qt::ImageConversionFlags ) hb_parni( 2 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createAlphaMask( ( HB_ISNUM( 2 ) ? ( Qt::ImageConversionFlags ) hb_parni( 2 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) ) ); } /* @@ -268,7 +276,7 @@ HB_FUNC( QT_QIMAGE_CREATEALPHAMASK ) */ HB_FUNC( QT_QIMAGE_CREATEHEURISTICMASK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->createHeuristicMask( hb_parl( 2 ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createHeuristicMask( hb_parl( 2 ) ) ) ) ); } /* @@ -276,7 +284,7 @@ HB_FUNC( QT_QIMAGE_CREATEHEURISTICMASK ) */ HB_FUNC( QT_QIMAGE_CREATEMASKFROMCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->createMaskFromColor( hb_parnl( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::MaskMode ) hb_parni( 3 ) : ( Qt::MaskMode ) Qt::MaskInColor ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createMaskFromColor( hb_parnl( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::MaskMode ) hb_parni( 3 ) : ( Qt::MaskMode ) Qt::MaskInColor ) ) ) ) ); } /* @@ -388,7 +396,7 @@ HB_FUNC( QT_QIMAGE_LOADFROMDATA ) */ HB_FUNC( QT_QIMAGE_MIRRORED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->mirrored( hb_parl( 2 ), hb_parl( 3 ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->mirrored( hb_parl( 2 ), hb_parl( 3 ) ) ) ) ); } /* @@ -412,7 +420,7 @@ HB_FUNC( QT_QIMAGE_NUMCOLORS ) */ HB_FUNC( QT_QIMAGE_OFFSET ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QImage( 1 )->offset() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QImage( 1 )->offset() ) ) ); } /* @@ -452,7 +460,7 @@ HB_FUNC( QT_QIMAGE_PIXELINDEX_1 ) */ HB_FUNC( QT_QIMAGE_RECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QImage( 1 )->rect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QImage( 1 )->rect() ) ) ); } /* @@ -460,7 +468,7 @@ HB_FUNC( QT_QIMAGE_RECT ) */ HB_FUNC( QT_QIMAGE_RGBSWAPPED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->rgbSwapped() ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->rgbSwapped() ) ) ); } /* @@ -484,7 +492,7 @@ HB_FUNC( QT_QIMAGE_SAVE_1 ) */ HB_FUNC( QT_QIMAGE_SCALED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->scaled( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::AspectRatioMode ) hb_parni( 3 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 4 ) ? ( Qt::TransformationMode ) hb_parni( 4 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaled( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::AspectRatioMode ) hb_parni( 3 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 4 ) ? ( Qt::TransformationMode ) hb_parni( 4 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -492,7 +500,7 @@ HB_FUNC( QT_QIMAGE_SCALED ) */ HB_FUNC( QT_QIMAGE_SCALED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->scaled( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( Qt::AspectRatioMode ) hb_parni( 4 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 5 ) ? ( Qt::TransformationMode ) hb_parni( 5 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaled( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( Qt::AspectRatioMode ) hb_parni( 4 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 5 ) ? ( Qt::TransformationMode ) hb_parni( 5 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -500,7 +508,7 @@ HB_FUNC( QT_QIMAGE_SCALED_1 ) */ HB_FUNC( QT_QIMAGE_SCALEDTOHEIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->scaledToHeight( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaledToHeight( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -508,7 +516,7 @@ HB_FUNC( QT_QIMAGE_SCALEDTOHEIGHT ) */ HB_FUNC( QT_QIMAGE_SCALEDTOWIDTH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->scaledToWidth( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaledToWidth( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -596,7 +604,7 @@ HB_FUNC( QT_QIMAGE_SETTEXT ) */ HB_FUNC( QT_QIMAGE_SIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QImage( 1 )->size() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QImage( 1 )->size() ) ) ); } /* @@ -612,7 +620,7 @@ HB_FUNC( QT_QIMAGE_TEXT ) */ HB_FUNC( QT_QIMAGE_TEXTKEYS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QImage( 1 )->textKeys() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QImage( 1 )->textKeys() ) ) ); } /* @@ -620,7 +628,7 @@ HB_FUNC( QT_QIMAGE_TEXTKEYS ) */ HB_FUNC( QT_QIMAGE_TRANSFORMED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->transformed( *hbqt_par_QMatrix( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->transformed( *hbqt_par_QMatrix( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -628,7 +636,7 @@ HB_FUNC( QT_QIMAGE_TRANSFORMED ) */ HB_FUNC( QT_QIMAGE_TRANSFORMED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImage( 1 )->transformed( *hbqt_par_QTransform( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->transformed( *hbqt_par_QTransform( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QImageReader.cpp b/harbour/contrib/hbqt/qtgui/QImageReader.cpp index bb42461411..9785f5a018 100644 --- a/harbour/contrib/hbqt/qtgui/QImageReader.cpp +++ b/harbour/contrib/hbqt/qtgui/QImageReader.cpp @@ -94,40 +94,48 @@ QT_G_FUNC( release_QImageReader ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QImageReader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QImageReader p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QImageReader ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QImageReader * ) ph )->~QImageReader(); - ph = NULL; + ( ( QImageReader * ) p->ph )->~QImageReader(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QImageReader Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QImageReader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QImageReader" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QImageReader Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QImageReader" ); + #endif } } +void * gcAllocate_QImageReader( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QImageReader; + #if defined(__debug__) + just_debug( " new_QImageReader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QIMAGEREADER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QImageReader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QImageReader* ) new QImageReader() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QImageReader; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QImageReader( pObj ) ); } /* * bool autoDetectImageFormat () const @@ -142,7 +150,7 @@ HB_FUNC( QT_QIMAGEREADER_AUTODETECTIMAGEFORMAT ) */ HB_FUNC( QT_QIMAGEREADER_BACKGROUNDCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QImageReader( 1 )->backgroundColor() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QImageReader( 1 )->backgroundColor() ) ) ); } /* @@ -158,7 +166,7 @@ HB_FUNC( QT_QIMAGEREADER_CANREAD ) */ HB_FUNC( QT_QIMAGEREADER_CLIPRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QImageReader( 1 )->clipRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->clipRect() ) ) ); } /* @@ -174,7 +182,7 @@ HB_FUNC( QT_QIMAGEREADER_CURRENTIMAGENUMBER ) */ HB_FUNC( QT_QIMAGEREADER_CURRENTIMAGERECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QImageReader( 1 )->currentImageRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->currentImageRect() ) ) ); } /* @@ -214,7 +222,7 @@ HB_FUNC( QT_QIMAGEREADER_FILENAME ) */ HB_FUNC( QT_QIMAGEREADER_FORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QImageReader( 1 )->format() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->format() ) ) ); } /* @@ -278,7 +286,7 @@ HB_FUNC( QT_QIMAGEREADER_QUALITY ) */ HB_FUNC( QT_QIMAGEREADER_READ ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QImageReader( 1 )->read() ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QImageReader( 1 )->read() ) ) ); } /* @@ -294,7 +302,7 @@ HB_FUNC( QT_QIMAGEREADER_READ_1 ) */ HB_FUNC( QT_QIMAGEREADER_SCALEDCLIPRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QImageReader( 1 )->scaledClipRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->scaledClipRect() ) ) ); } /* @@ -302,7 +310,7 @@ HB_FUNC( QT_QIMAGEREADER_SCALEDCLIPRECT ) */ HB_FUNC( QT_QIMAGEREADER_SCALEDSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QImageReader( 1 )->scaledSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QImageReader( 1 )->scaledSize() ) ) ); } /* @@ -382,7 +390,7 @@ HB_FUNC( QT_QIMAGEREADER_SETSCALEDSIZE ) */ HB_FUNC( QT_QIMAGEREADER_SIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QImageReader( 1 )->size() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QImageReader( 1 )->size() ) ) ); } /* @@ -414,7 +422,7 @@ HB_FUNC( QT_QIMAGEREADER_TEXT ) */ HB_FUNC( QT_QIMAGEREADER_TEXTKEYS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QImageReader( 1 )->textKeys() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QImageReader( 1 )->textKeys() ) ) ); } /* @@ -422,7 +430,7 @@ HB_FUNC( QT_QIMAGEREADER_TEXTKEYS ) */ HB_FUNC( QT_QIMAGEREADER_IMAGEFORMAT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QImageReader( 1 )->imageFormat( hbqt_par_QString( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->imageFormat( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -430,7 +438,7 @@ HB_FUNC( QT_QIMAGEREADER_IMAGEFORMAT_1 ) */ HB_FUNC( QT_QIMAGEREADER_IMAGEFORMAT_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QImageReader( 1 )->imageFormat( hbqt_par_QIODevice( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->imageFormat( hbqt_par_QIODevice( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QImageWriter.cpp b/harbour/contrib/hbqt/qtgui/QImageWriter.cpp index b2c76dcff5..93db039099 100644 --- a/harbour/contrib/hbqt/qtgui/QImageWriter.cpp +++ b/harbour/contrib/hbqt/qtgui/QImageWriter.cpp @@ -93,40 +93,48 @@ QT_G_FUNC( release_QImageWriter ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QImageWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QImageWriter p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QImageWriter ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QImageWriter * ) ph )->~QImageWriter(); - ph = NULL; + ( ( QImageWriter * ) p->ph )->~QImageWriter(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QImageWriter Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QImageWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QImageWriter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QImageWriter Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QImageWriter" ); + #endif } } +void * gcAllocate_QImageWriter( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QImageWriter; + #if defined(__debug__) + just_debug( " new_QImageWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QIMAGEWRITER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QImageWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QImageWriter* ) new QImageWriter() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QImageWriter; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QImageWriter( pObj ) ); } /* * bool canWrite () const @@ -181,7 +189,7 @@ HB_FUNC( QT_QIMAGEWRITER_FILENAME ) */ HB_FUNC( QT_QIMAGEWRITER_FORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QImageWriter( 1 )->format() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageWriter( 1 )->format() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QInputContext.cpp b/harbour/contrib/hbqt/qtgui/QInputContext.cpp index 95a0fb33b7..edd4e574d0 100644 --- a/harbour/contrib/hbqt/qtgui/QInputContext.cpp +++ b/harbour/contrib/hbqt/qtgui/QInputContext.cpp @@ -94,31 +94,7 @@ QT_G_FUNC( release_QInputContext ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QInputContext %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QInputContext * ) ph )->~QInputContext(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QInputContext" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QInputContext" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QINPUTCONTEXT ) @@ -137,7 +113,7 @@ HB_FUNC( QT_QINPUTCONTEXT_FILTEREVENT ) */ HB_FUNC( QT_QINPUTCONTEXT_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QInputContext( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QInputContext( 1 )->font() ) ) ); } /* @@ -193,7 +169,7 @@ HB_FUNC( QT_QINPUTCONTEXT_SENDEVENT ) */ HB_FUNC( QT_QINPUTCONTEXT_STANDARDFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextFormat( hbqt_par_QInputContext( 1 )->standardFormat( ( QInputContext::StandardFormat ) hb_parni( 2 ) ) ), release_QTextFormat ) ); + hb_retptrGC( gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QInputContext( 1 )->standardFormat( ( QInputContext::StandardFormat ) hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QInputDialog.cpp b/harbour/contrib/hbqt/qtgui/QInputDialog.cpp index 3839ffe5b4..b218232223 100644 --- a/harbour/contrib/hbqt/qtgui/QInputDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QInputDialog.cpp @@ -82,52 +82,69 @@ * ~QInputDialog () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QInputDialog > pq; +} QGC_POINTER_QInputDialog; + QT_G_FUNC( release_QInputDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QInputDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QInputDialog * p = ( QGC_POINTER_QInputDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QInputDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QInputDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QInputDialog * ) ph )->~QInputDialog(); - ph = NULL; + ( ( QInputDialog * ) p->ph )->~QInputDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QInputDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QInputDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QInputDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QInputDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QInputDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QInputDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QInputDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QInputDialog" ); + #endif } } +void * gcAllocate_QInputDialog( void * pObj ) +{ + QGC_POINTER_QInputDialog * p = ( QGC_POINTER_QInputDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QInputDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QInputDialog; + new( & p->pq ) QPointer< QInputDialog >( ( QInputDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QInputDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QINPUTDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QInputDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QInputDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QInputDialog * ) new QInputDialog( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QInputDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QInputDialog( pObj ) ); } /* * QString cancelButtonText () const @@ -142,7 +159,7 @@ HB_FUNC( QT_QINPUTDIALOG_CANCELBUTTONTEXT ) */ HB_FUNC( QT_QINPUTDIALOG_COMBOBOXITEMS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QInputDialog( 1 )->comboBoxItems() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QInputDialog( 1 )->comboBoxItems() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QInputEvent.cpp b/harbour/contrib/hbqt/qtgui/QInputEvent.cpp index 3674779da5..f5bc641cbc 100644 --- a/harbour/contrib/hbqt/qtgui/QInputEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QInputEvent.cpp @@ -78,40 +78,48 @@ QT_G_FUNC( release_QInputEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QInputEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QInputEvent p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QInputEvent ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QInputEvent * ) ph )->~QInputEvent(); - ph = NULL; + ( ( QInputEvent * ) p->ph )->~QInputEvent(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QInputEvent Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QInputEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QInputEvent" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QInputEvent Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QInputEvent" ); + #endif } } +void * gcAllocate_QInputEvent( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QInputEvent; + #if defined(__debug__) + just_debug( " new_QInputEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QINPUTEVENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QInputEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QInputEvent* ) new QInputEvent( ( QEvent::Type ) hb_parni( 1 ), ( Qt::KeyboardModifiers ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QInputEvent; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QInputEvent( pObj ) ); } /* * Qt::KeyboardModifiers modifiers () const diff --git a/harbour/contrib/hbqt/qtgui/QInputMethodEvent.cpp b/harbour/contrib/hbqt/qtgui/QInputMethodEvent.cpp index f22f13d53e..937a736788 100644 --- a/harbour/contrib/hbqt/qtgui/QInputMethodEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QInputMethodEvent.cpp @@ -91,40 +91,48 @@ QT_G_FUNC( release_QInputMethodEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QInputMethodEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QInputMethodEvent p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QInputMethodEvent ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QInputMethodEvent * ) ph )->~QInputMethodEvent(); - ph = NULL; + ( ( QInputMethodEvent * ) p->ph )->~QInputMethodEvent(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QInputMethodEvent Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QInputMethodEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QInputMethodEvent" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QInputMethodEvent Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QInputMethodEvent" ); + #endif } } +void * gcAllocate_QInputMethodEvent( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QInputMethodEvent; + #if defined(__debug__) + just_debug( " new_QInputMethodEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QINPUTMETHODEVENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QInputMethodEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QInputMethodEvent() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QInputMethodEvent; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QInputMethodEvent( pObj ) ); } /* * const QString & commitString () const diff --git a/harbour/contrib/hbqt/qtgui/QItemSelection.cpp b/harbour/contrib/hbqt/qtgui/QItemSelection.cpp index 1302e46c57..6a07507616 100644 --- a/harbour/contrib/hbqt/qtgui/QItemSelection.cpp +++ b/harbour/contrib/hbqt/qtgui/QItemSelection.cpp @@ -77,40 +77,48 @@ QT_G_FUNC( release_QItemSelection ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QItemSelection %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelection p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelection ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QItemSelection * ) ph )->~QItemSelection(); - ph = NULL; + ( ( QItemSelection * ) p->ph )->~QItemSelection(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelection Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QItemSelection %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QItemSelection" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelection Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QItemSelection" ); + #endif } } +void * gcAllocate_QItemSelection( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QItemSelection; + #if defined(__debug__) + just_debug( " new_QItemSelection %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QITEMSELECTION ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QItemSelection %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QItemSelection() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QItemSelection; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QItemSelection( pObj ) ); } /* * bool contains ( const QModelIndex & index ) const diff --git a/harbour/contrib/hbqt/qtgui/QItemSelectionModel.cpp b/harbour/contrib/hbqt/qtgui/QItemSelectionModel.cpp index e2d8789a05..e8deb83074 100644 --- a/harbour/contrib/hbqt/qtgui/QItemSelectionModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QItemSelectionModel.cpp @@ -81,55 +81,72 @@ * virtual ~QItemSelectionModel () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QItemSelectionModel > pq; +} QGC_POINTER_QItemSelectionModel; + QT_G_FUNC( release_QItemSelectionModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QItemSelectionModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QItemSelectionModel * p = ( QGC_POINTER_QItemSelectionModel * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelectionModel p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelectionModel ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QItemSelectionModel * ) ph )->~QItemSelectionModel(); - ph = NULL; + ( ( QItemSelectionModel * ) p->ph )->~QItemSelectionModel(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelectionModel Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QItemSelectionModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QItemSelectionModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelectionModel Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QItemSelectionModel" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QItemSelectionModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QItemSelectionModel Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QItemSelectionModel" ); + #endif } } +void * gcAllocate_QItemSelectionModel( void * pObj ) +{ + QGC_POINTER_QItemSelectionModel * p = ( QGC_POINTER_QItemSelectionModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QItemSelectionModel ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QItemSelectionModel; + new( & p->pq ) QPointer< QItemSelectionModel >( ( QItemSelectionModel * ) pObj ); + #if defined(__debug__) + just_debug( " new_QItemSelectionModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QITEMSELECTIONMODEL ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QItemSelectionModel > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QItemSelectionModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { pObj = new QItemSelectionModel( hbqt_par_QAbstractItemModel( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QItemSelectionModel; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QItemSelectionModel( pObj ) ); } /* * bool columnIntersectsSelection ( int column, const QModelIndex & parent ) const @@ -144,7 +161,7 @@ HB_FUNC( QT_QITEMSELECTIONMODEL_COLUMNINTERSECTSSELECTION ) */ HB_FUNC( QT_QITEMSELECTIONMODEL_CURRENTINDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QItemSelectionModel( 1 )->currentIndex() ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QItemSelectionModel( 1 )->currentIndex() ) ) ); } /* @@ -200,7 +217,7 @@ HB_FUNC( QT_QITEMSELECTIONMODEL_ROWINTERSECTSSELECTION ) */ HB_FUNC( QT_QITEMSELECTIONMODEL_SELECTION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QItemSelection( hbqt_par_QItemSelectionModel( 1 )->selection() ), release_QItemSelection ) ); + hb_retptrGC( gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QItemSelectionModel( 1 )->selection() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QKeyEvent.cpp b/harbour/contrib/hbqt/qtgui/QKeyEvent.cpp index 4b07138ab9..7c74002dba 100644 --- a/harbour/contrib/hbqt/qtgui/QKeyEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QKeyEvent.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QKeyEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QKeyEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QKeyEvent * ) ph )->~QKeyEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QKeyEvent" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QKeyEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QKEYEVENT ) diff --git a/harbour/contrib/hbqt/qtgui/QKeySequence.cpp b/harbour/contrib/hbqt/qtgui/QKeySequence.cpp index 470e09a139..de8a293b85 100644 --- a/harbour/contrib/hbqt/qtgui/QKeySequence.cpp +++ b/harbour/contrib/hbqt/qtgui/QKeySequence.cpp @@ -97,30 +97,44 @@ QT_G_FUNC( release_QKeySequence ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QKeySequence %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QKeySequence p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QKeySequence ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QKeySequence * ) ph )->~QKeySequence(); - ph = NULL; + ( ( QKeySequence * ) p->ph )->~QKeySequence(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QKeySequence Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QKeySequence %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QKeySequence" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QKeySequence Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QKeySequence" ); + #endif } } +void * gcAllocate_QKeySequence( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QKeySequence; + #if defined(__debug__) + just_debug( " new_QKeySequence %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QKEYSEQUENCE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QKeySequence %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( HB_ISPOINTER( 1 ) ) pObj = ( QKeySequence * ) new QKeySequence( *hbqt_par_QKeySequence( 1 ) ) ; @@ -131,13 +145,7 @@ hb_snprintf( str, sizeof(str), " GC: new QKeySequence %i B %i else pObj = ( QKeySequence * ) new QKeySequence() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QKeySequence; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QKeySequence( pObj ) ); } /* * uint count () const @@ -176,7 +184,7 @@ HB_FUNC( QT_QKEYSEQUENCE_TOSTRING ) */ HB_FUNC( QT_QKEYSEQUENCE_FROMSTRING ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QKeySequence( hbqt_par_QKeySequence( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QKeySequence::SequenceFormat ) hb_parni( 3 ) : ( QKeySequence::SequenceFormat ) QKeySequence::PortableText ) ) ), release_QKeySequence ) ); + hb_retptrGC( gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QKeySequence( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QKeySequence::SequenceFormat ) hb_parni( 3 ) : ( QKeySequence::SequenceFormat ) QKeySequence::PortableText ) ) ) ) ); } /* @@ -184,7 +192,7 @@ HB_FUNC( QT_QKEYSEQUENCE_FROMSTRING ) */ HB_FUNC( QT_QKEYSEQUENCE_MNEMONIC ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QKeySequence( hbqt_par_QKeySequence( 1 )->mnemonic( hbqt_par_QString( 2 ) ) ), release_QKeySequence ) ); + hb_retptrGC( gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QKeySequence( 1 )->mnemonic( hbqt_par_QString( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QLCDNumber.cpp b/harbour/contrib/hbqt/qtgui/QLCDNumber.cpp index e0cf917656..fd2443bd01 100644 --- a/harbour/contrib/hbqt/qtgui/QLCDNumber.cpp +++ b/harbour/contrib/hbqt/qtgui/QLCDNumber.cpp @@ -82,52 +82,69 @@ * ~QLCDNumber () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QLCDNumber > pq; +} QGC_POINTER_QLCDNumber; + QT_G_FUNC( release_QLCDNumber ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLCDNumber %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QLCDNumber * p = ( QGC_POINTER_QLCDNumber * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLCDNumber p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QLCDNumber ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QLCDNumber * ) ph )->~QLCDNumber(); - ph = NULL; + ( ( QLCDNumber * ) p->ph )->~QLCDNumber(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLCDNumber Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLCDNumber %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QLCDNumber" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLCDNumber Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QLCDNumber" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLCDNumber" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLCDNumber Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLCDNumber" ); + #endif } } +void * gcAllocate_QLCDNumber( void * pObj ) +{ + QGC_POINTER_QLCDNumber * p = ( QGC_POINTER_QLCDNumber * ) hb_gcAllocate( sizeof( QGC_POINTER_QLCDNumber ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLCDNumber; + new( & p->pq ) QPointer< QLCDNumber >( ( QLCDNumber * ) pObj ); + #if defined(__debug__) + just_debug( " new_QLCDNumber %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLCDNUMBER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QLCDNumber > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLCDNumber %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QLCDNumber * ) new QLCDNumber( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLCDNumber; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLCDNumber( pObj ) ); } /* * bool checkOverflow ( double num ) const diff --git a/harbour/contrib/hbqt/qtgui/QLabel.cpp b/harbour/contrib/hbqt/qtgui/QLabel.cpp index 18f19e92ab..86c635dbe2 100644 --- a/harbour/contrib/hbqt/qtgui/QLabel.cpp +++ b/harbour/contrib/hbqt/qtgui/QLabel.cpp @@ -77,52 +77,69 @@ * ~QLabel () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QLabel > pq; +} QGC_POINTER_QLabel; + QT_G_FUNC( release_QLabel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLabel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QLabel * p = ( QGC_POINTER_QLabel * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLabel p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QLabel ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QLabel * ) ph )->~QLabel(); - ph = NULL; + ( ( QLabel * ) p->ph )->~QLabel(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLabel Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLabel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QLabel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLabel Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QLabel" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLabel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLabel Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLabel" ); + #endif } } +void * gcAllocate_QLabel( void * pObj ) +{ + QGC_POINTER_QLabel * p = ( QGC_POINTER_QLabel * ) hb_gcAllocate( sizeof( QGC_POINTER_QLabel ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLabel; + new( & p->pq ) QPointer< QLabel >( ( QLabel * ) pObj ); + #if defined(__debug__) + just_debug( " new_QLabel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLABEL ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QLabel > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLabel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QLabel* ) new QLabel( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLabel; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLabel( pObj ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QLayout.cpp b/harbour/contrib/hbqt/qtgui/QLayout.cpp index 96391556e9..2161e3027e 100644 --- a/harbour/contrib/hbqt/qtgui/QLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QLayout.cpp @@ -82,31 +82,7 @@ QT_G_FUNC( release_QLayout ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QLayout * ) ph )->~QLayout(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QLayout" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLayout" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QLAYOUT ) @@ -141,7 +117,7 @@ HB_FUNC( QT_QLAYOUT_ADDWIDGET ) */ HB_FUNC( QT_QLAYOUT_CONTENTSRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QLayout( 1 )->contentsRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QLayout( 1 )->contentsRect() ) ) ); } /* @@ -207,7 +183,7 @@ HB_FUNC( QT_QLAYOUT_ITEMAT ) */ HB_FUNC( QT_QLAYOUT_MAXIMUMSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QLayout( 1 )->maximumSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->maximumSize() ) ) ); } /* @@ -223,7 +199,7 @@ HB_FUNC( QT_QLAYOUT_MENUBAR ) */ HB_FUNC( QT_QLAYOUT_MINIMUMSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QLayout( 1 )->minimumSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->minimumSize() ) ) ); } /* @@ -351,7 +327,7 @@ HB_FUNC( QT_QLAYOUT_UPDATE ) */ HB_FUNC( QT_QLAYOUT_CLOSESTACCEPTABLESIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QLayout( 1 )->closestAcceptableSize( hbqt_par_QWidget( 2 ), *hbqt_par_QSize( 3 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->closestAcceptableSize( hbqt_par_QWidget( 2 ), *hbqt_par_QSize( 3 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QLayoutItem.cpp b/harbour/contrib/hbqt/qtgui/QLayoutItem.cpp index ad31356d2d..21a3c8c335 100644 --- a/harbour/contrib/hbqt/qtgui/QLayoutItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QLayoutItem.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QLayoutItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLayoutItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QLayoutItem * ) ph )->~QLayoutItem(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QLayoutItem" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLayoutItem" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QLAYOUTITEM ) @@ -137,7 +113,7 @@ HB_FUNC( QT_QLAYOUTITEM_EXPANDINGDIRECTIONS ) */ HB_FUNC( QT_QLAYOUTITEM_GEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QLayoutItem( 1 )->geometry() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QLayoutItem( 1 )->geometry() ) ) ); } /* @@ -185,7 +161,7 @@ HB_FUNC( QT_QLAYOUTITEM_LAYOUT ) */ HB_FUNC( QT_QLAYOUTITEM_MAXIMUMSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QLayoutItem( 1 )->maximumSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->maximumSize() ) ) ); } /* @@ -201,7 +177,7 @@ HB_FUNC( QT_QLAYOUTITEM_MINIMUMHEIGHTFORWIDTH ) */ HB_FUNC( QT_QLAYOUTITEM_MINIMUMSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QLayoutItem( 1 )->minimumSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->minimumSize() ) ) ); } /* @@ -225,7 +201,7 @@ HB_FUNC( QT_QLAYOUTITEM_SETGEOMETRY ) */ HB_FUNC( QT_QLAYOUTITEM_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QLayoutItem( 1 )->sizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->sizeHint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QLineEdit.cpp b/harbour/contrib/hbqt/qtgui/QLineEdit.cpp index 31cdc69577..97e2910884 100644 --- a/harbour/contrib/hbqt/qtgui/QLineEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QLineEdit.cpp @@ -81,52 +81,69 @@ * ~QLineEdit () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QLineEdit > pq; +} QGC_POINTER_QLineEdit; + QT_G_FUNC( release_QLineEdit ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLineEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QLineEdit * p = ( QGC_POINTER_QLineEdit * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLineEdit p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QLineEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QLineEdit * ) ph )->~QLineEdit(); - ph = NULL; + ( ( QLineEdit * ) p->ph )->~QLineEdit(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLineEdit Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLineEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QLineEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLineEdit Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QLineEdit" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLineEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLineEdit Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLineEdit" ); + #endif } } +void * gcAllocate_QLineEdit( void * pObj ) +{ + QGC_POINTER_QLineEdit * p = ( QGC_POINTER_QLineEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QLineEdit ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLineEdit; + new( & p->pq ) QPointer< QLineEdit >( ( QLineEdit * ) pObj ); + #if defined(__debug__) + just_debug( " new_QLineEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLINEEDIT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QLineEdit > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLineEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QLineEdit* ) new QLineEdit( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLineEdit; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLineEdit( pObj ) ); } /* * Qt::Alignment alignment () const @@ -367,7 +384,7 @@ HB_FUNC( QT_QLINEEDIT_MAXLENGTH ) */ HB_FUNC( QT_QLINEEDIT_MINIMUMSIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QLineEdit( 1 )->minimumSizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QLineEdit( 1 )->minimumSizeHint() ) ) ); } /* @@ -495,7 +512,7 @@ HB_FUNC( QT_QLINEEDIT_SETVALIDATOR ) */ HB_FUNC( QT_QLINEEDIT_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QLineEdit( 1 )->sizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QLineEdit( 1 )->sizeHint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QLinearGradient.cpp b/harbour/contrib/hbqt/qtgui/QLinearGradient.cpp index 8984520b7f..a9c13f5b53 100644 --- a/harbour/contrib/hbqt/qtgui/QLinearGradient.cpp +++ b/harbour/contrib/hbqt/qtgui/QLinearGradient.cpp @@ -85,30 +85,44 @@ QT_G_FUNC( release_QLinearGradient ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QLinearGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QLinearGradient p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QLinearGradient ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QLinearGradient * ) ph )->~QLinearGradient(); - ph = NULL; + ( ( QLinearGradient * ) p->ph )->~QLinearGradient(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QLinearGradient Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QLinearGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QLinearGradient" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QLinearGradient Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QLinearGradient" ); + #endif } } +void * gcAllocate_QLinearGradient( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QLinearGradient; + #if defined(__debug__) + just_debug( " new_QLinearGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLINEARGRADIENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QLinearGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -127,20 +141,14 @@ hb_snprintf( str, sizeof(str), " GC: new QLinearGradient %i B %i pObj = ( QLinearGradient* ) new QLinearGradient() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QLinearGradient; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QLinearGradient( pObj ) ); } /* * QPointF finalStop () const */ HB_FUNC( QT_QLINEARGRADIENT_FINALSTOP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QLinearGradient( 1 )->finalStop() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QLinearGradient( 1 )->finalStop() ) ) ); } /* @@ -180,7 +188,7 @@ HB_FUNC( QT_QLINEARGRADIENT_SETSTART_1 ) */ HB_FUNC( QT_QLINEARGRADIENT_START ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QLinearGradient( 1 )->start() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QLinearGradient( 1 )->start() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QListView.cpp b/harbour/contrib/hbqt/qtgui/QListView.cpp index 1d29fe87a2..19ca73d124 100644 --- a/harbour/contrib/hbqt/qtgui/QListView.cpp +++ b/harbour/contrib/hbqt/qtgui/QListView.cpp @@ -84,52 +84,69 @@ * ~QListView () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QListView > pq; +} QGC_POINTER_QListView; + QT_G_FUNC( release_QListView ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QListView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QListView * p = ( QGC_POINTER_QListView * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QListView p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QListView ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QListView * ) ph )->~QListView(); - ph = NULL; + ( ( QListView * ) p->ph )->~QListView(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QListView Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QListView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QListView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QListView Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QListView" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QListView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QListView Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QListView" ); + #endif } } +void * gcAllocate_QListView( void * pObj ) +{ + QGC_POINTER_QListView * p = ( QGC_POINTER_QListView * ) hb_gcAllocate( sizeof( QGC_POINTER_QListView ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QListView; + new( & p->pq ) QPointer< QListView >( ( QListView * ) pObj ); + #if defined(__debug__) + just_debug( " new_QListView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLISTVIEW ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QListView > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QListView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QListView * ) new QListView( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QListView; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QListView( pObj ) ); } /* * int batchSize () const @@ -160,7 +177,7 @@ HB_FUNC( QT_QLISTVIEW_FLOW ) */ HB_FUNC( QT_QLISTVIEW_GRIDSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QListView( 1 )->gridSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QListView( 1 )->gridSize() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QListWidget.cpp b/harbour/contrib/hbqt/qtgui/QListWidget.cpp index c37a8e3b30..a93d240fdf 100644 --- a/harbour/contrib/hbqt/qtgui/QListWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QListWidget.cpp @@ -86,52 +86,69 @@ * ~QListWidget () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QListWidget > pq; +} QGC_POINTER_QListWidget; + QT_G_FUNC( release_QListWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QListWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QListWidget * p = ( QGC_POINTER_QListWidget * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidget p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QListWidget * ) ph )->~QListWidget(); - ph = NULL; + ( ( QListWidget * ) p->ph )->~QListWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QListWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QListWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidget Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QListWidget" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QListWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QListWidget" ); + #endif } } +void * gcAllocate_QListWidget( void * pObj ) +{ + QGC_POINTER_QListWidget * p = ( QGC_POINTER_QListWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QListWidget ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QListWidget; + new( & p->pq ) QPointer< QListWidget >( ( QListWidget * ) pObj ); + #if defined(__debug__) + just_debug( " new_QListWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLISTWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QListWidget > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QListWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QListWidget( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QListWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QListWidget( pObj ) ); } /* * void addItem ( const QString & label ) @@ -354,7 +371,7 @@ HB_FUNC( QT_QLISTWIDGET_TAKEITEM ) */ HB_FUNC( QT_QLISTWIDGET_VISUALITEMRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QListWidget( 1 )->visualItemRect( hbqt_par_QListWidgetItem( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QListWidget( 1 )->visualItemRect( hbqt_par_QListWidgetItem( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QListWidgetItem.cpp b/harbour/contrib/hbqt/qtgui/QListWidgetItem.cpp index 5b9844ae12..6de3ecbddd 100644 --- a/harbour/contrib/hbqt/qtgui/QListWidgetItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QListWidgetItem.cpp @@ -85,47 +85,55 @@ QT_G_FUNC( release_QListWidgetItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QListWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidgetItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidgetItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QListWidgetItem * ) ph )->~QListWidgetItem(); - ph = NULL; + ( ( QListWidgetItem * ) p->ph )->~QListWidgetItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidgetItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QListWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QListWidgetItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QListWidgetItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QListWidgetItem" ); + #endif } } +void * gcAllocate_QListWidgetItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QListWidgetItem; + #if defined(__debug__) + just_debug( " new_QListWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QLISTWIDGETITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QListWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QListWidgetItem( hbqt_par_QListWidget( 1 ), hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QListWidgetItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QListWidgetItem( pObj ) ); } /* * QBrush background () const */ HB_FUNC( QT_QLISTWIDGETITEM_BACKGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QListWidgetItem( 1 )->background() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QListWidgetItem( 1 )->background() ) ) ); } /* @@ -149,7 +157,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_CLONE ) */ HB_FUNC( QT_QLISTWIDGETITEM_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QListWidgetItem( 1 )->data( hb_parni( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QListWidgetItem( 1 )->data( hb_parni( 2 ) ) ) ) ); } /* @@ -165,7 +173,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_FLAGS ) */ HB_FUNC( QT_QLISTWIDGETITEM_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QListWidgetItem( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QListWidgetItem( 1 )->font() ) ) ); } /* @@ -173,7 +181,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_FONT ) */ HB_FUNC( QT_QLISTWIDGETITEM_FOREGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QListWidgetItem( 1 )->foreground() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QListWidgetItem( 1 )->foreground() ) ) ); } /* @@ -181,7 +189,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_FOREGROUND ) */ HB_FUNC( QT_QLISTWIDGETITEM_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QListWidgetItem( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QListWidgetItem( 1 )->icon() ) ) ); } /* @@ -341,7 +349,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_SETWHATSTHIS ) */ HB_FUNC( QT_QLISTWIDGETITEM_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QListWidgetItem( 1 )->sizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QListWidgetItem( 1 )->sizeHint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMainWindow.cpp b/harbour/contrib/hbqt/qtgui/QMainWindow.cpp index ba04199c02..f59b3181aa 100644 --- a/harbour/contrib/hbqt/qtgui/QMainWindow.cpp +++ b/harbour/contrib/hbqt/qtgui/QMainWindow.cpp @@ -90,52 +90,69 @@ * ~QMainWindow () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QMainWindow > pq; +} QGC_POINTER_QMainWindow; + QT_G_FUNC( release_QMainWindow ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMainWindow %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QMainWindow * p = ( QGC_POINTER_QMainWindow * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QMainWindow p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QMainWindow ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QMainWindow * ) ph )->~QMainWindow(); - ph = NULL; + ( ( QMainWindow * ) p->ph )->~QMainWindow(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QMainWindow Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QMainWindow %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QMainWindow" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMainWindow Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QMainWindow" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMainWindow" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMainWindow Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QMainWindow" ); + #endif } } +void * gcAllocate_QMainWindow( void * pObj ) +{ + QGC_POINTER_QMainWindow * p = ( QGC_POINTER_QMainWindow * ) hb_gcAllocate( sizeof( QGC_POINTER_QMainWindow ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QMainWindow; + new( & p->pq ) QPointer< QMainWindow >( ( QMainWindow * ) pObj ); + #if defined(__debug__) + just_debug( " new_QMainWindow %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMAINWINDOW ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QMainWindow > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QMainWindow %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QMainWindow* ) new QMainWindow( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QMainWindow; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QMainWindow( pObj ) ); } /* * void addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget ) @@ -238,7 +255,7 @@ HB_FUNC( QT_QMAINWINDOW_DOCUMENTMODE ) */ HB_FUNC( QT_QMAINWINDOW_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QMainWindow( 1 )->iconSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QMainWindow( 1 )->iconSize() ) ) ); } /* @@ -334,7 +351,7 @@ HB_FUNC( QT_QMAINWINDOW_RESTORESTATE ) */ HB_FUNC( QT_QMAINWINDOW_SAVESTATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QMainWindow( 1 )->saveState( hb_parni( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QMainWindow( 1 )->saveState( hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMatrix.cpp b/harbour/contrib/hbqt/qtgui/QMatrix.cpp index ecbc60dfb6..6df8a72fbd 100644 --- a/harbour/contrib/hbqt/qtgui/QMatrix.cpp +++ b/harbour/contrib/hbqt/qtgui/QMatrix.cpp @@ -79,40 +79,48 @@ QT_G_FUNC( release_QMatrix ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMatrix %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QMatrix p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QMatrix ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QMatrix * ) ph )->~QMatrix(); - ph = NULL; + ( ( QMatrix * ) p->ph )->~QMatrix(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QMatrix Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QMatrix %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMatrix" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMatrix Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QMatrix" ); + #endif } } +void * gcAllocate_QMatrix( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QMatrix; + #if defined(__debug__) + just_debug( " new_QMatrix %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMATRIX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QMatrix %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QMatrix() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QMatrix; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QMatrix( pObj ) ); } /* * qreal m11 () const @@ -177,7 +185,7 @@ HB_FUNC( QT_QMATRIX_INVERTED ) { bool iInvertible = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QMatrix( 1 )->inverted( &iInvertible ) ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->inverted( &iInvertible ) ) ) ); hb_stornl( iInvertible, 2 ); } @@ -231,7 +239,7 @@ HB_FUNC( QT_QMATRIX_MAP_1 ) */ HB_FUNC( QT_QMATRIX_MAP_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPointF( 2 ) ) ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPointF( 2 ) ) ) ) ); } /* @@ -239,7 +247,7 @@ HB_FUNC( QT_QMATRIX_MAP_2 ) */ HB_FUNC( QT_QMATRIX_MAP_3 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPoint( 2 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -247,7 +255,7 @@ HB_FUNC( QT_QMATRIX_MAP_3 ) */ HB_FUNC( QT_QMATRIX_MAP_4 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLineF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QLineF( 2 ) ) ), release_QLineF ) ); + hb_retptrGC( gcAllocate_QLineF( new QLineF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QLineF( 2 ) ) ) ) ); } /* @@ -255,7 +263,7 @@ HB_FUNC( QT_QMATRIX_MAP_4 ) */ HB_FUNC( QT_QMATRIX_MAP_5 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLine( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QLine( 2 ) ) ), release_QLine ) ); + hb_retptrGC( gcAllocate_QLine( new QLine( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QLine( 2 ) ) ) ) ); } /* @@ -263,7 +271,7 @@ HB_FUNC( QT_QMATRIX_MAP_5 ) */ HB_FUNC( QT_QMATRIX_MAP_6 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygonF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPolygonF( 2 ) ) ), release_QPolygonF ) ); + hb_retptrGC( gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPolygonF( 2 ) ) ) ) ); } /* @@ -271,7 +279,7 @@ HB_FUNC( QT_QMATRIX_MAP_6 ) */ HB_FUNC( QT_QMATRIX_MAP_7 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygon( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPolygon( 2 ) ) ), release_QPolygon ) ); + hb_retptrGC( gcAllocate_QPolygon( new QPolygon( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPolygon( 2 ) ) ) ) ); } /* @@ -279,7 +287,7 @@ HB_FUNC( QT_QMATRIX_MAP_7 ) */ HB_FUNC( QT_QMATRIX_MAP_8 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QRegion( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QRegion( 2 ) ) ) ) ); } /* @@ -287,7 +295,7 @@ HB_FUNC( QT_QMATRIX_MAP_8 ) */ HB_FUNC( QT_QMATRIX_MAP_9 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPainterPath( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPainterPath( 2 ) ) ), release_QPainterPath ) ); + hb_retptrGC( gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPainterPath( 2 ) ) ) ) ); } /* @@ -295,7 +303,7 @@ HB_FUNC( QT_QMATRIX_MAP_9 ) */ HB_FUNC( QT_QMATRIX_MAPRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QMatrix( 1 )->mapRect( *hbqt_par_QRectF( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QMatrix( 1 )->mapRect( *hbqt_par_QRectF( 2 ) ) ) ) ); } /* @@ -303,7 +311,7 @@ HB_FUNC( QT_QMATRIX_MAPRECT ) */ HB_FUNC( QT_QMATRIX_MAPRECT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QMatrix( 1 )->mapRect( *hbqt_par_QRect( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QMatrix( 1 )->mapRect( *hbqt_par_QRect( 2 ) ) ) ) ); } /* @@ -311,7 +319,7 @@ HB_FUNC( QT_QMATRIX_MAPRECT_1 ) */ HB_FUNC( QT_QMATRIX_MAPTOPOLYGON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygon( hbqt_par_QMatrix( 1 )->mapToPolygon( *hbqt_par_QRect( 2 ) ) ), release_QPolygon ) ); + hb_retptrGC( gcAllocate_QPolygon( new QPolygon( hbqt_par_QMatrix( 1 )->mapToPolygon( *hbqt_par_QRect( 2 ) ) ) ) ); } /* @@ -327,7 +335,7 @@ HB_FUNC( QT_QMATRIX_RESET ) */ HB_FUNC( QT_QMATRIX_ROTATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QMatrix( 1 )->rotate( hb_parnd( 2 ) ) ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->rotate( hb_parnd( 2 ) ) ) ) ); } /* @@ -335,7 +343,7 @@ HB_FUNC( QT_QMATRIX_ROTATE ) */ HB_FUNC( QT_QMATRIX_SCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QMatrix( 1 )->scale( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->scale( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* @@ -351,7 +359,7 @@ HB_FUNC( QT_QMATRIX_SETMATRIX ) */ HB_FUNC( QT_QMATRIX_SHEAR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QMatrix( 1 )->shear( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->shear( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* @@ -359,7 +367,7 @@ HB_FUNC( QT_QMATRIX_SHEAR ) */ HB_FUNC( QT_QMATRIX_TRANSLATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QMatrix( 1 )->translate( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->translate( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QMenu.cpp b/harbour/contrib/hbqt/qtgui/QMenu.cpp index 9dad0c341b..70c5bc92bb 100644 --- a/harbour/contrib/hbqt/qtgui/QMenu.cpp +++ b/harbour/contrib/hbqt/qtgui/QMenu.cpp @@ -87,42 +87,65 @@ * ~QMenu () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QMenu > pq; +} QGC_POINTER_QMenu; + QT_G_FUNC( release_QMenu ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMenu %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QMenu * p = ( QGC_POINTER_QMenu * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QMenu p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QMenu ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QMenu * ) ph )->~QMenu(); - ph = NULL; + ( ( QMenu * ) p->ph )->~QMenu(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QMenu Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QMenu %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QMenu" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMenu Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QMenu" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMenu" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMenu Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QMenu" ); + #endif } } +void * gcAllocate_QMenu( void * pObj ) +{ + QGC_POINTER_QMenu * p = ( QGC_POINTER_QMenu * ) hb_gcAllocate( sizeof( QGC_POINTER_QMenu ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QMenu; + new( & p->pq ) QPointer< QMenu >( ( QMenu * ) pObj ); + #if defined(__debug__) + just_debug( " new_QMenu %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMENU ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QMenu > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QMenu %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 1 && HB_ISCHAR( 1 ) ) { @@ -133,13 +156,7 @@ hb_snprintf( str, sizeof(str), " GC: new QMenu %i B %i pObj = ( QMenu* ) new QMenu( hbqt_par_QWidget( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QMenu; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QMenu( pObj ) ); } /* * QAction * actionAt ( const QPoint & pt ) const @@ -154,7 +171,7 @@ HB_FUNC( QT_QMENU_ACTIONAT ) */ HB_FUNC( QT_QMENU_ACTIONGEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QMenu( 1 )->actionGeometry( hbqt_par_QAction( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QMenu( 1 )->actionGeometry( hbqt_par_QAction( 2 ) ) ) ) ); } /* @@ -282,7 +299,7 @@ HB_FUNC( QT_QMENU_HIDETEAROFFMENU ) */ HB_FUNC( QT_QMENU_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QMenu( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QMenu( 1 )->icon() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMenuBar.cpp b/harbour/contrib/hbqt/qtgui/QMenuBar.cpp index 21763e896e..faa8d7bd1f 100644 --- a/harbour/contrib/hbqt/qtgui/QMenuBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QMenuBar.cpp @@ -90,52 +90,69 @@ * ~QMenuBar () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QMenuBar > pq; +} QGC_POINTER_QMenuBar; + QT_G_FUNC( release_QMenuBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMenuBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QMenuBar * p = ( QGC_POINTER_QMenuBar * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QMenuBar p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QMenuBar ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QMenuBar * ) ph )->~QMenuBar(); - ph = NULL; + ( ( QMenuBar * ) p->ph )->~QMenuBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QMenuBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QMenuBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QMenuBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMenuBar Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QMenuBar" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMenuBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMenuBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QMenuBar" ); + #endif } } +void * gcAllocate_QMenuBar( void * pObj ) +{ + QGC_POINTER_QMenuBar * p = ( QGC_POINTER_QMenuBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QMenuBar ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QMenuBar; + new( & p->pq ) QPointer< QMenuBar >( ( QMenuBar * ) pObj ); + #if defined(__debug__) + just_debug( " new_QMenuBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMENUBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QMenuBar > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QMenuBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QMenuBar* ) new QMenuBar( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QMenuBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QMenuBar( pObj ) ); } /* * QAction * activeAction () const diff --git a/harbour/contrib/hbqt/qtgui/QMessageBox.cpp b/harbour/contrib/hbqt/qtgui/QMessageBox.cpp index d2cfced782..8772d1925b 100644 --- a/harbour/contrib/hbqt/qtgui/QMessageBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QMessageBox.cpp @@ -93,52 +93,69 @@ * ~QMessageBox () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QMessageBox > pq; +} QGC_POINTER_QMessageBox; + QT_G_FUNC( release_QMessageBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMessageBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QMessageBox * p = ( QGC_POINTER_QMessageBox * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QMessageBox p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QMessageBox ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QMessageBox * ) ph )->~QMessageBox(); - ph = NULL; + ( ( QMessageBox * ) p->ph )->~QMessageBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QMessageBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QMessageBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QMessageBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMessageBox Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QMessageBox" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMessageBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMessageBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QMessageBox" ); + #endif } } +void * gcAllocate_QMessageBox( void * pObj ) +{ + QGC_POINTER_QMessageBox * p = ( QGC_POINTER_QMessageBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QMessageBox ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QMessageBox; + new( & p->pq ) QPointer< QMessageBox >( ( QMessageBox * ) pObj ); + #if defined(__debug__) + just_debug( " new_QMessageBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMESSAGEBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QMessageBox > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QMessageBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QMessageBox* ) new QMessageBox() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QMessageBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QMessageBox( pObj ) ); } /* * void addButton ( QAbstractButton * button, ButtonRole role ) @@ -225,7 +242,7 @@ HB_FUNC( QT_QMESSAGEBOX_ICON ) */ HB_FUNC( QT_QMESSAGEBOX_ICONPIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QMessageBox( 1 )->iconPixmap() ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QMessageBox( 1 )->iconPixmap() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMouseEvent.cpp b/harbour/contrib/hbqt/qtgui/QMouseEvent.cpp index 2bc3413245..6b87c37e6c 100644 --- a/harbour/contrib/hbqt/qtgui/QMouseEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QMouseEvent.cpp @@ -79,43 +79,51 @@ QT_G_FUNC( release_QMouseEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMouseEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QMouseEvent p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QMouseEvent ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QMouseEvent * ) ph )->~QMouseEvent(); - ph = NULL; + ( ( QMouseEvent * ) p->ph )->~QMouseEvent(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QMouseEvent Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QMouseEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMouseEvent" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMouseEvent Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QMouseEvent" ); + #endif } } +void * gcAllocate_QMouseEvent( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QMouseEvent; + #if defined(__debug__) + just_debug( " new_QMouseEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMOUSEEVENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QMouseEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { pObj = new QMouseEvent( *hbqt_par_QMouseEvent( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QMouseEvent; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QMouseEvent( pObj ) ); } /* * Qt::MouseButton button () const @@ -138,7 +146,7 @@ HB_FUNC( QT_QMOUSEEVENT_BUTTONS ) */ HB_FUNC( QT_QMOUSEEVENT_GLOBALPOS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QMouseEvent( 1 )->globalPos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QMouseEvent( 1 )->globalPos() ) ) ); } /* @@ -162,7 +170,7 @@ HB_FUNC( QT_QMOUSEEVENT_GLOBALY ) */ HB_FUNC( QT_QMOUSEEVENT_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QMouseEvent( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QMouseEvent( 1 )->pos() ) ) ); } /* @@ -170,7 +178,7 @@ HB_FUNC( QT_QMOUSEEVENT_POS ) */ HB_FUNC( QT_QMOUSEEVENT_POSF ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QMouseEvent( 1 )->posF() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QMouseEvent( 1 )->posF() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMoveEvent.cpp b/harbour/contrib/hbqt/qtgui/QMoveEvent.cpp index d9dff129e1..6aeb136147 100644 --- a/harbour/contrib/hbqt/qtgui/QMoveEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QMoveEvent.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QMoveEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMoveEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QMoveEvent * ) ph )->~QMoveEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QMoveEvent" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMoveEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QMOVEEVENT ) @@ -113,7 +89,7 @@ HB_FUNC( QT_QMOVEEVENT ) */ HB_FUNC( QT_QMOVEEVENT_OLDPOS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QMoveEvent( 1 )->oldPos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QMoveEvent( 1 )->oldPos() ) ) ); } /* @@ -121,7 +97,7 @@ HB_FUNC( QT_QMOVEEVENT_OLDPOS ) */ HB_FUNC( QT_QMOVEEVENT_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QMoveEvent( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QMoveEvent( 1 )->pos() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QMovie.cpp b/harbour/contrib/hbqt/qtgui/QMovie.cpp index dee987ff31..91247a6cd2 100644 --- a/harbour/contrib/hbqt/qtgui/QMovie.cpp +++ b/harbour/contrib/hbqt/qtgui/QMovie.cpp @@ -84,59 +84,76 @@ * ~QMovie () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QMovie > pq; +} QGC_POINTER_QMovie; + QT_G_FUNC( release_QMovie ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QMovie %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QMovie * p = ( QGC_POINTER_QMovie * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QMovie p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QMovie ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QMovie * ) ph )->~QMovie(); - ph = NULL; + ( ( QMovie * ) p->ph )->~QMovie(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QMovie Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QMovie %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QMovie" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMovie Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QMovie" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QMovie" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QMovie Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QMovie" ); + #endif } } +void * gcAllocate_QMovie( void * pObj ) +{ + QGC_POINTER_QMovie * p = ( QGC_POINTER_QMovie * ) hb_gcAllocate( sizeof( QGC_POINTER_QMovie ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QMovie; + new( & p->pq ) QPointer< QMovie >( ( QMovie * ) pObj ); + #if defined(__debug__) + just_debug( " new_QMovie %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QMOVIE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QMovie > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QMovie %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QMovie() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QMovie; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QMovie( pObj ) ); } /* * QColor backgroundColor () const */ HB_FUNC( QT_QMOVIE_BACKGROUNDCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QMovie( 1 )->backgroundColor() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QMovie( 1 )->backgroundColor() ) ) ); } /* @@ -160,7 +177,7 @@ HB_FUNC( QT_QMOVIE_CURRENTFRAMENUMBER ) */ HB_FUNC( QT_QMOVIE_CURRENTIMAGE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QMovie( 1 )->currentImage() ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QMovie( 1 )->currentImage() ) ) ); } /* @@ -168,7 +185,7 @@ HB_FUNC( QT_QMOVIE_CURRENTIMAGE ) */ HB_FUNC( QT_QMOVIE_CURRENTPIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QMovie( 1 )->currentPixmap() ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QMovie( 1 )->currentPixmap() ) ) ); } /* @@ -192,7 +209,7 @@ HB_FUNC( QT_QMOVIE_FILENAME ) */ HB_FUNC( QT_QMOVIE_FORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QMovie( 1 )->format() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QMovie( 1 )->format() ) ) ); } /* @@ -208,7 +225,7 @@ HB_FUNC( QT_QMOVIE_FRAMECOUNT ) */ HB_FUNC( QT_QMOVIE_FRAMERECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QMovie( 1 )->frameRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QMovie( 1 )->frameRect() ) ) ); } /* @@ -248,7 +265,7 @@ HB_FUNC( QT_QMOVIE_NEXTFRAMEDELAY ) */ HB_FUNC( QT_QMOVIE_SCALEDSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QMovie( 1 )->scaledSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QMovie( 1 )->scaledSize() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPageSetupDialog.cpp b/harbour/contrib/hbqt/qtgui/QPageSetupDialog.cpp index ff149a20ba..cd55c6269e 100644 --- a/harbour/contrib/hbqt/qtgui/QPageSetupDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QPageSetupDialog.cpp @@ -81,55 +81,72 @@ * QPageSetupDialog ( QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QPageSetupDialog > pq; +} QGC_POINTER_QPageSetupDialog; + QT_G_FUNC( release_QPageSetupDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPageSetupDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QPageSetupDialog * p = ( QGC_POINTER_QPageSetupDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPageSetupDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QPageSetupDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QPageSetupDialog * ) ph )->~QPageSetupDialog(); - ph = NULL; + ( ( QPageSetupDialog * ) p->ph )->~QPageSetupDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPageSetupDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPageSetupDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QPageSetupDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPageSetupDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QPageSetupDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPageSetupDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPageSetupDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPageSetupDialog" ); + #endif } } +void * gcAllocate_QPageSetupDialog( void * pObj ) +{ + QGC_POINTER_QPageSetupDialog * p = ( QGC_POINTER_QPageSetupDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QPageSetupDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPageSetupDialog; + new( & p->pq ) QPointer< QPageSetupDialog >( ( QPageSetupDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QPageSetupDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPAGESETUPDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QPageSetupDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPageSetupDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 2 ) pObj = ( QPageSetupDialog* ) new QPageSetupDialog( hbqt_par_QPrinter( 1 ), hbqt_par_QWidget( 1 ) ) ; else pObj = ( QPageSetupDialog* ) new QPageSetupDialog( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPageSetupDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPageSetupDialog( pObj ) ); } /* * virtual int exec () diff --git a/harbour/contrib/hbqt/qtgui/QPaintDevice.cpp b/harbour/contrib/hbqt/qtgui/QPaintDevice.cpp index c9d07527f3..c54b0f145f 100644 --- a/harbour/contrib/hbqt/qtgui/QPaintDevice.cpp +++ b/harbour/contrib/hbqt/qtgui/QPaintDevice.cpp @@ -80,31 +80,7 @@ QT_G_FUNC( release_QPaintDevice ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPaintDevice %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QPaintDevice * ) ph )->~QPaintDevice(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QPaintDevice" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPaintDevice" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QPAINTDEVICE ) diff --git a/harbour/contrib/hbqt/qtgui/QPaintEvent.cpp b/harbour/contrib/hbqt/qtgui/QPaintEvent.cpp index 4fe676cbb9..24e0e24d30 100644 --- a/harbour/contrib/hbqt/qtgui/QPaintEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QPaintEvent.cpp @@ -78,30 +78,44 @@ QT_G_FUNC( release_QPaintEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPaintEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPaintEvent p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPaintEvent ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPaintEvent * ) ph )->~QPaintEvent(); - ph = NULL; + ( ( QPaintEvent * ) p->ph )->~QPaintEvent(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPaintEvent Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPaintEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPaintEvent" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPaintEvent Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPaintEvent" ); + #endif } } +void * gcAllocate_QPaintEvent( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPaintEvent; + #if defined(__debug__) + just_debug( " new_QPaintEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPAINTEVENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPaintEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 2 && HB_ISCHAR( 1 ) && HB_ISPOINTER( 2 ) ) { @@ -117,20 +131,14 @@ hb_snprintf( str, sizeof(str), " GC: new QPaintEvent %i B %i } } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPaintEvent; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPaintEvent( pObj ) ); } /* * const QRect & rect () const */ HB_FUNC( QT_QPAINTEVENT_RECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPaintEvent( 1 )->rect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPaintEvent( 1 )->rect() ) ) ); } /* @@ -138,7 +146,7 @@ HB_FUNC( QT_QPAINTEVENT_RECT ) */ HB_FUNC( QT_QPAINTEVENT_REGION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QPaintEvent( 1 )->region() ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QPaintEvent( 1 )->region() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPainter.cpp b/harbour/contrib/hbqt/qtgui/QPainter.cpp index 917d53992c..806aa33563 100644 --- a/harbour/contrib/hbqt/qtgui/QPainter.cpp +++ b/harbour/contrib/hbqt/qtgui/QPainter.cpp @@ -98,30 +98,44 @@ QT_G_FUNC( release_QPainter ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPainter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPainter p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPainter ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPainter * ) ph )->~QPainter(); - ph = NULL; + ( ( QPainter * ) p->ph )->~QPainter(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPainter Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPainter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPainter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPainter Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPainter" ); + #endif } } +void * gcAllocate_QPainter( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPainter; + #if defined(__debug__) + just_debug( " new_QPainter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPAINTER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPainter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() >= 1 && HB_ISPOINTER( 1 ) ) { @@ -132,20 +146,14 @@ hb_snprintf( str, sizeof(str), " GC: new QPainter %i B %i pObj = new QPainter() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPainter; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPainter( pObj ) ); } /* * const QBrush & background () const */ HB_FUNC( QT_QPAINTER_BACKGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPainter( 1 )->background() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPainter( 1 )->background() ) ) ); } /* @@ -169,7 +177,7 @@ HB_FUNC( QT_QPAINTER_BEGIN ) */ HB_FUNC( QT_QPAINTER_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ) ) ) ) ); } /* @@ -177,7 +185,7 @@ HB_FUNC( QT_QPAINTER_BOUNDINGRECT ) */ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ) ) ) ) ); } /* @@ -185,7 +193,7 @@ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_1 ) */ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPainter( 1 )->boundingRect( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hbqt_par_QString( 7 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->boundingRect( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hbqt_par_QString( 7 ) ) ) ) ); } /* @@ -193,7 +201,7 @@ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_2 ) */ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_3 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hbqt_par_QString( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QTextOption( 4 ) : QTextOption() ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hbqt_par_QString( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QTextOption( 4 ) : QTextOption() ) ) ) ) ); } /* @@ -201,7 +209,7 @@ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_3 ) */ HB_FUNC( QT_QPAINTER_BRUSH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPainter( 1 )->brush() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPainter( 1 )->brush() ) ) ); } /* @@ -209,7 +217,7 @@ HB_FUNC( QT_QPAINTER_BRUSH ) */ HB_FUNC( QT_QPAINTER_BRUSHORIGIN ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QPainter( 1 )->brushOrigin() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QPainter( 1 )->brushOrigin() ) ) ); } /* @@ -217,7 +225,7 @@ HB_FUNC( QT_QPAINTER_BRUSHORIGIN ) */ HB_FUNC( QT_QPAINTER_CLIPPATH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPainterPath( hbqt_par_QPainter( 1 )->clipPath() ), release_QPainterPath ) ); + hb_retptrGC( gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainter( 1 )->clipPath() ) ) ); } /* @@ -225,7 +233,7 @@ HB_FUNC( QT_QPAINTER_CLIPPATH ) */ HB_FUNC( QT_QPAINTER_CLIPREGION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QPainter( 1 )->clipRegion() ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QPainter( 1 )->clipRegion() ) ) ); } /* @@ -233,7 +241,7 @@ HB_FUNC( QT_QPAINTER_CLIPREGION ) */ HB_FUNC( QT_QPAINTER_COMBINEDMATRIX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QPainter( 1 )->combinedMatrix() ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->combinedMatrix() ) ) ); } /* @@ -241,7 +249,7 @@ HB_FUNC( QT_QPAINTER_COMBINEDMATRIX ) */ HB_FUNC( QT_QPAINTER_COMBINEDTRANSFORM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QPainter( 1 )->combinedTransform() ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->combinedTransform() ) ) ); } /* @@ -265,7 +273,7 @@ HB_FUNC( QT_QPAINTER_DEVICE ) */ HB_FUNC( QT_QPAINTER_DEVICEMATRIX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QPainter( 1 )->deviceMatrix() ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->deviceMatrix() ) ) ); } /* @@ -273,7 +281,7 @@ HB_FUNC( QT_QPAINTER_DEVICEMATRIX ) */ HB_FUNC( QT_QPAINTER_DEVICETRANSFORM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QPainter( 1 )->deviceTransform() ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->deviceTransform() ) ) ); } /* @@ -1089,7 +1097,7 @@ HB_FUNC( QT_QPAINTER_FILLRECT_11 ) */ HB_FUNC( QT_QPAINTER_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QPainter( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QPainter( 1 )->font() ) ) ); } /* @@ -1097,7 +1105,7 @@ HB_FUNC( QT_QPAINTER_FONT ) */ HB_FUNC( QT_QPAINTER_FONTINFO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFontInfo( hbqt_par_QPainter( 1 )->fontInfo() ), release_QFontInfo ) ); + hb_retptrGC( gcAllocate_QFontInfo( new QFontInfo( hbqt_par_QPainter( 1 )->fontInfo() ) ) ); } /* @@ -1105,7 +1113,7 @@ HB_FUNC( QT_QPAINTER_FONTINFO ) */ HB_FUNC( QT_QPAINTER_FONTMETRICS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFontMetrics( hbqt_par_QPainter( 1 )->fontMetrics() ), release_QFontMetrics ) ); + hb_retptrGC( gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QPainter( 1 )->fontMetrics() ) ) ); } /* @@ -1161,7 +1169,7 @@ HB_FUNC( QT_QPAINTER_PAINTENGINE ) */ HB_FUNC( QT_QPAINTER_PEN ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPen( hbqt_par_QPainter( 1 )->pen() ), release_QPen ) ); + hb_retptrGC( gcAllocate_QPen( new QPen( hbqt_par_QPainter( 1 )->pen() ) ) ); } /* @@ -1497,7 +1505,7 @@ HB_FUNC( QT_QPAINTER_TESTRENDERHINT ) */ HB_FUNC( QT_QPAINTER_TRANSFORM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QPainter( 1 )->transform() ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->transform() ) ) ); } /* @@ -1537,7 +1545,7 @@ HB_FUNC( QT_QPAINTER_VIEWTRANSFORMENABLED ) */ HB_FUNC( QT_QPAINTER_VIEWPORT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPainter( 1 )->viewport() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->viewport() ) ) ); } /* @@ -1545,7 +1553,7 @@ HB_FUNC( QT_QPAINTER_VIEWPORT ) */ HB_FUNC( QT_QPAINTER_WINDOW ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPainter( 1 )->window() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->window() ) ) ); } /* @@ -1553,7 +1561,7 @@ HB_FUNC( QT_QPAINTER_WINDOW ) */ HB_FUNC( QT_QPAINTER_WORLDMATRIX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QPainter( 1 )->worldMatrix() ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->worldMatrix() ) ) ); } /* @@ -1569,7 +1577,7 @@ HB_FUNC( QT_QPAINTER_WORLDMATRIXENABLED ) */ HB_FUNC( QT_QPAINTER_WORLDTRANSFORM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QPainter( 1 )->worldTransform() ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->worldTransform() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPainterPath.cpp b/harbour/contrib/hbqt/qtgui/QPainterPath.cpp index 23108b2bad..112361f136 100644 --- a/harbour/contrib/hbqt/qtgui/QPainterPath.cpp +++ b/harbour/contrib/hbqt/qtgui/QPainterPath.cpp @@ -99,40 +99,48 @@ QT_G_FUNC( release_QPainterPath ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPainterPath %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPainterPath p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPainterPath ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPainterPath * ) ph )->~QPainterPath(); - ph = NULL; + ( ( QPainterPath * ) p->ph )->~QPainterPath(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPainterPath Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPainterPath %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPainterPath" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPainterPath Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPainterPath" ); + #endif } } +void * gcAllocate_QPainterPath( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPainterPath; + #if defined(__debug__) + just_debug( " new_QPainterPath %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPAINTERPATH ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPainterPath %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QPainterPath() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPainterPath; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPainterPath( pObj ) ); } /* * void addEllipse ( const QRectF & boundingRectangle ) @@ -275,7 +283,7 @@ HB_FUNC( QT_QPAINTERPATH_ARCTO_1 ) */ HB_FUNC( QT_QPAINTERPATH_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QPainterPath( 1 )->boundingRect() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QPainterPath( 1 )->boundingRect() ) ) ); } /* @@ -323,7 +331,7 @@ HB_FUNC( QT_QPAINTERPATH_CONTAINS_2 ) */ HB_FUNC( QT_QPAINTERPATH_CONTROLPOINTRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QPainterPath( 1 )->controlPointRect() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QPainterPath( 1 )->controlPointRect() ) ) ); } /* @@ -347,7 +355,7 @@ HB_FUNC( QT_QPAINTERPATH_CUBICTO_1 ) */ HB_FUNC( QT_QPAINTERPATH_CURRENTPOSITION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QPainterPath( 1 )->currentPosition() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QPainterPath( 1 )->currentPosition() ) ) ); } /* @@ -371,7 +379,7 @@ HB_FUNC( QT_QPAINTERPATH_FILLRULE ) */ HB_FUNC( QT_QPAINTERPATH_INTERSECTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPainterPath( hbqt_par_QPainterPath( 1 )->intersected( *hbqt_par_QPainterPath( 2 ) ) ), release_QPainterPath ) ); + hb_retptrGC( gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->intersected( *hbqt_par_QPainterPath( 2 ) ) ) ) ); } /* @@ -451,7 +459,7 @@ HB_FUNC( QT_QPAINTERPATH_PERCENTATLENGTH ) */ HB_FUNC( QT_QPAINTERPATH_POINTATPERCENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QPainterPath( 1 )->pointAtPercent( hb_parnd( 2 ) ) ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QPainterPath( 1 )->pointAtPercent( hb_parnd( 2 ) ) ) ) ); } /* @@ -491,7 +499,7 @@ HB_FUNC( QT_QPAINTERPATH_SETFILLRULE ) */ HB_FUNC( QT_QPAINTERPATH_SIMPLIFIED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPainterPath( hbqt_par_QPainterPath( 1 )->simplified() ), release_QPainterPath ) ); + hb_retptrGC( gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->simplified() ) ) ); } /* @@ -507,7 +515,7 @@ HB_FUNC( QT_QPAINTERPATH_SLOPEATPERCENT ) */ HB_FUNC( QT_QPAINTERPATH_SUBTRACTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPainterPath( hbqt_par_QPainterPath( 1 )->subtracted( *hbqt_par_QPainterPath( 2 ) ) ), release_QPainterPath ) ); + hb_retptrGC( gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->subtracted( *hbqt_par_QPainterPath( 2 ) ) ) ) ); } /* @@ -515,7 +523,7 @@ HB_FUNC( QT_QPAINTERPATH_SUBTRACTED ) */ HB_FUNC( QT_QPAINTERPATH_TOFILLPOLYGON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygonF( hbqt_par_QPainterPath( 1 )->toFillPolygon( *hbqt_par_QTransform( 2 ) ) ), release_QPolygonF ) ); + hb_retptrGC( gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPainterPath( 1 )->toFillPolygon( *hbqt_par_QTransform( 2 ) ) ) ) ); } /* @@ -523,7 +531,7 @@ HB_FUNC( QT_QPAINTERPATH_TOFILLPOLYGON ) */ HB_FUNC( QT_QPAINTERPATH_TOFILLPOLYGON_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygonF( hbqt_par_QPainterPath( 1 )->toFillPolygon( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QMatrix( 2 ) : QMatrix() ) ) ), release_QPolygonF ) ); + hb_retptrGC( gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPainterPath( 1 )->toFillPolygon( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QMatrix( 2 ) : QMatrix() ) ) ) ) ); } /* @@ -531,7 +539,7 @@ HB_FUNC( QT_QPAINTERPATH_TOFILLPOLYGON_1 ) */ HB_FUNC( QT_QPAINTERPATH_TOREVERSED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPainterPath( hbqt_par_QPainterPath( 1 )->toReversed() ), release_QPainterPath ) ); + hb_retptrGC( gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->toReversed() ) ) ); } /* @@ -539,7 +547,7 @@ HB_FUNC( QT_QPAINTERPATH_TOREVERSED ) */ HB_FUNC( QT_QPAINTERPATH_UNITED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPainterPath( hbqt_par_QPainterPath( 1 )->united( *hbqt_par_QPainterPath( 2 ) ) ), release_QPainterPath ) ); + hb_retptrGC( gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->united( *hbqt_par_QPainterPath( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPalette.cpp b/harbour/contrib/hbqt/qtgui/QPalette.cpp index 6f881cb8f9..5d3721b928 100644 --- a/harbour/contrib/hbqt/qtgui/QPalette.cpp +++ b/harbour/contrib/hbqt/qtgui/QPalette.cpp @@ -88,30 +88,44 @@ QT_G_FUNC( release_QPalette ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPalette %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPalette p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPalette ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPalette * ) ph )->~QPalette(); - ph = NULL; + ( ( QPalette * ) p->ph )->~QPalette(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPalette Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPalette %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPalette" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPalette Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPalette" ); + #endif } } +void * gcAllocate_QPalette( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPalette; + #if defined(__debug__) + just_debug( " new_QPalette %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPALETTE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPalette %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISNUM( 1 ) ) { @@ -130,20 +144,14 @@ hb_snprintf( str, sizeof(str), " GC: new QPalette %i B %i pObj = ( QPalette* ) new QPalette() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPalette; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPalette( pObj ) ); } /* * const QBrush & alternateBase () const */ HB_FUNC( QT_QPALETTE_ALTERNATEBASE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->alternateBase() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->alternateBase() ) ) ); } /* @@ -151,7 +159,7 @@ HB_FUNC( QT_QPALETTE_ALTERNATEBASE ) */ HB_FUNC( QT_QPALETTE_BASE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->base() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->base() ) ) ); } /* @@ -159,7 +167,7 @@ HB_FUNC( QT_QPALETTE_BASE ) */ HB_FUNC( QT_QPALETTE_BRIGHTTEXT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->brightText() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brightText() ) ) ); } /* @@ -167,7 +175,7 @@ HB_FUNC( QT_QPALETTE_BRIGHTTEXT ) */ HB_FUNC( QT_QPALETTE_BRUSH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->brush( ( QPalette::ColorGroup ) hb_parni( 2 ), ( QPalette::ColorRole ) hb_parni( 3 ) ) ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brush( ( QPalette::ColorGroup ) hb_parni( 2 ), ( QPalette::ColorRole ) hb_parni( 3 ) ) ) ) ); } /* @@ -175,7 +183,7 @@ HB_FUNC( QT_QPALETTE_BRUSH ) */ HB_FUNC( QT_QPALETTE_BRUSH_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->brush( ( QPalette::ColorRole ) hb_parni( 2 ) ) ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brush( ( QPalette::ColorRole ) hb_parni( 2 ) ) ) ) ); } /* @@ -183,7 +191,7 @@ HB_FUNC( QT_QPALETTE_BRUSH_1 ) */ HB_FUNC( QT_QPALETTE_BUTTON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->button() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->button() ) ) ); } /* @@ -191,7 +199,7 @@ HB_FUNC( QT_QPALETTE_BUTTON ) */ HB_FUNC( QT_QPALETTE_BUTTONTEXT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->buttonText() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->buttonText() ) ) ); } /* @@ -207,7 +215,7 @@ HB_FUNC( QT_QPALETTE_CACHEKEY ) */ HB_FUNC( QT_QPALETTE_COLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QPalette( 1 )->color( ( QPalette::ColorGroup ) hb_parni( 2 ), ( QPalette::ColorRole ) hb_parni( 3 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QPalette( 1 )->color( ( QPalette::ColorGroup ) hb_parni( 2 ), ( QPalette::ColorRole ) hb_parni( 3 ) ) ) ) ); } /* @@ -215,7 +223,7 @@ HB_FUNC( QT_QPALETTE_COLOR ) */ HB_FUNC( QT_QPALETTE_COLOR_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QPalette( 1 )->color( ( QPalette::ColorRole ) hb_parni( 2 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QPalette( 1 )->color( ( QPalette::ColorRole ) hb_parni( 2 ) ) ) ) ); } /* @@ -231,7 +239,7 @@ HB_FUNC( QT_QPALETTE_CURRENTCOLORGROUP ) */ HB_FUNC( QT_QPALETTE_DARK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->dark() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->dark() ) ) ); } /* @@ -239,7 +247,7 @@ HB_FUNC( QT_QPALETTE_DARK ) */ HB_FUNC( QT_QPALETTE_HIGHLIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->highlight() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->highlight() ) ) ); } /* @@ -247,7 +255,7 @@ HB_FUNC( QT_QPALETTE_HIGHLIGHT ) */ HB_FUNC( QT_QPALETTE_HIGHLIGHTEDTEXT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->highlightedText() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->highlightedText() ) ) ); } /* @@ -279,7 +287,7 @@ HB_FUNC( QT_QPALETTE_ISEQUAL ) */ HB_FUNC( QT_QPALETTE_LIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->light() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->light() ) ) ); } /* @@ -287,7 +295,7 @@ HB_FUNC( QT_QPALETTE_LIGHT ) */ HB_FUNC( QT_QPALETTE_LINK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->link() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->link() ) ) ); } /* @@ -295,7 +303,7 @@ HB_FUNC( QT_QPALETTE_LINK ) */ HB_FUNC( QT_QPALETTE_LINKVISITED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->linkVisited() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->linkVisited() ) ) ); } /* @@ -303,7 +311,7 @@ HB_FUNC( QT_QPALETTE_LINKVISITED ) */ HB_FUNC( QT_QPALETTE_MID ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->mid() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->mid() ) ) ); } /* @@ -311,7 +319,7 @@ HB_FUNC( QT_QPALETTE_MID ) */ HB_FUNC( QT_QPALETTE_MIDLIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->midlight() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->midlight() ) ) ); } /* @@ -319,7 +327,7 @@ HB_FUNC( QT_QPALETTE_MIDLIGHT ) */ HB_FUNC( QT_QPALETTE_RESOLVE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPalette( hbqt_par_QPalette( 1 )->resolve( *hbqt_par_QPalette( 2 ) ) ), release_QPalette ) ); + hb_retptrGC( gcAllocate_QPalette( new QPalette( hbqt_par_QPalette( 1 )->resolve( *hbqt_par_QPalette( 2 ) ) ) ) ); } /* @@ -375,7 +383,7 @@ HB_FUNC( QT_QPALETTE_SETCURRENTCOLORGROUP ) */ HB_FUNC( QT_QPALETTE_SHADOW ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->shadow() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->shadow() ) ) ); } /* @@ -383,7 +391,7 @@ HB_FUNC( QT_QPALETTE_SHADOW ) */ HB_FUNC( QT_QPALETTE_TEXT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->text() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->text() ) ) ); } /* @@ -391,7 +399,7 @@ HB_FUNC( QT_QPALETTE_TEXT ) */ HB_FUNC( QT_QPALETTE_TOOLTIPBASE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->toolTipBase() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->toolTipBase() ) ) ); } /* @@ -399,7 +407,7 @@ HB_FUNC( QT_QPALETTE_TOOLTIPBASE ) */ HB_FUNC( QT_QPALETTE_TOOLTIPTEXT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->toolTipText() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->toolTipText() ) ) ); } /* @@ -407,7 +415,7 @@ HB_FUNC( QT_QPALETTE_TOOLTIPTEXT ) */ HB_FUNC( QT_QPALETTE_WINDOW ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->window() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->window() ) ) ); } /* @@ -415,7 +423,7 @@ HB_FUNC( QT_QPALETTE_WINDOW ) */ HB_FUNC( QT_QPALETTE_WINDOWTEXT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPalette( 1 )->windowText() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->windowText() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPen.cpp b/harbour/contrib/hbqt/qtgui/QPen.cpp index 4fa3511323..0dab75d513 100644 --- a/harbour/contrib/hbqt/qtgui/QPen.cpp +++ b/harbour/contrib/hbqt/qtgui/QPen.cpp @@ -92,30 +92,44 @@ QT_G_FUNC( release_QPen ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPen %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPen p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPen ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPen * ) ph )->~QPen(); - ph = NULL; + ( ( QPen * ) p->ph )->~QPen(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPen Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPen %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPen" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPen Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPen" ); + #endif } } +void * gcAllocate_QPen( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPen; + #if defined(__debug__) + just_debug( " new_QPen %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPEN ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPen %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISNUM( 1 ) ) { @@ -151,20 +165,14 @@ hb_snprintf( str, sizeof(str), " GC: new QPen %i B %i pObj = ( QPen* ) new QPen() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPen; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPen( pObj ) ); } /* * QBrush brush () const */ HB_FUNC( QT_QPEN_BRUSH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QPen( 1 )->brush() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QPen( 1 )->brush() ) ) ); } /* @@ -180,7 +188,7 @@ HB_FUNC( QT_QPEN_CAPSTYLE ) */ HB_FUNC( QT_QPEN_COLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QPen( 1 )->color() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QPen( 1 )->color() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPicture.cpp b/harbour/contrib/hbqt/qtgui/QPicture.cpp index d63ade48e1..033793654b 100644 --- a/harbour/contrib/hbqt/qtgui/QPicture.cpp +++ b/harbour/contrib/hbqt/qtgui/QPicture.cpp @@ -79,30 +79,44 @@ QT_G_FUNC( release_QPicture ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPicture %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPicture p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPicture ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPicture * ) ph )->~QPicture(); - ph = NULL; + ( ( QPicture * ) p->ph )->~QPicture(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPicture Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPicture %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPicture" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPicture Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPicture" ); + #endif } } +void * gcAllocate_QPicture( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPicture; + #if defined(__debug__) + just_debug( " new_QPicture %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPICTURE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPicture %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISNUM( 1 ) ) { @@ -117,20 +131,14 @@ hb_snprintf( str, sizeof(str), " GC: new QPicture %i B %i pObj = new QPicture() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPicture; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPicture( pObj ) ); } /* * QRect boundingRect () const */ HB_FUNC( QT_QPICTURE_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPicture( 1 )->boundingRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPicture( 1 )->boundingRect() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPixmap.cpp b/harbour/contrib/hbqt/qtgui/QPixmap.cpp index ba06ecf606..72b6ba3782 100644 --- a/harbour/contrib/hbqt/qtgui/QPixmap.cpp +++ b/harbour/contrib/hbqt/qtgui/QPixmap.cpp @@ -88,30 +88,44 @@ QT_G_FUNC( release_QPixmap ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPixmap %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPixmap p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPixmap ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPixmap * ) ph )->~QPixmap(); - ph = NULL; + ( ( QPixmap * ) p->ph )->~QPixmap(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPixmap Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPixmap %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPixmap" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPixmap Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPixmap" ); + #endif } } +void * gcAllocate_QPixmap( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPixmap; + #if defined(__debug__) + just_debug( " new_QPixmap %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPIXMAP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPixmap %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) { @@ -130,20 +144,14 @@ hb_snprintf( str, sizeof(str), " GC: new QPixmap %i B %i pObj = new QPixmap() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPixmap; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPixmap( pObj ) ); } /* * QPixmap alphaChannel () const */ HB_FUNC( QT_QPIXMAP_ALPHACHANNEL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->alphaChannel() ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->alphaChannel() ) ) ); } /* @@ -159,7 +167,7 @@ HB_FUNC( QT_QPIXMAP_CACHEKEY ) */ HB_FUNC( QT_QPIXMAP_COPY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->copy( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QRect( 2 ) : QRect() ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->copy( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QRect( 2 ) : QRect() ) ) ) ) ); } /* @@ -167,7 +175,7 @@ HB_FUNC( QT_QPIXMAP_COPY ) */ HB_FUNC( QT_QPIXMAP_COPY_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->copy( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->copy( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ) ) ); } /* @@ -175,7 +183,7 @@ HB_FUNC( QT_QPIXMAP_COPY_1 ) */ HB_FUNC( QT_QPIXMAP_CREATEHEURISTICMASK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBitmap( hbqt_par_QPixmap( 1 )->createHeuristicMask( hb_parl( 2 ) ) ), release_QBitmap ) ); + hb_retptrGC( gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createHeuristicMask( hb_parl( 2 ) ) ) ) ); } /* @@ -183,7 +191,7 @@ HB_FUNC( QT_QPIXMAP_CREATEHEURISTICMASK ) */ HB_FUNC( QT_QPIXMAP_CREATEMASKFROMCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBitmap( hbqt_par_QPixmap( 1 )->createMaskFromColor( *hbqt_par_QColor( 2 ), ( Qt::MaskMode ) hb_parni( 3 ) ) ), release_QBitmap ) ); + hb_retptrGC( gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createMaskFromColor( *hbqt_par_QColor( 2 ), ( Qt::MaskMode ) hb_parni( 3 ) ) ) ) ); } /* @@ -191,7 +199,7 @@ HB_FUNC( QT_QPIXMAP_CREATEMASKFROMCOLOR ) */ HB_FUNC( QT_QPIXMAP_CREATEMASKFROMCOLOR_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBitmap( hbqt_par_QPixmap( 1 )->createMaskFromColor( *hbqt_par_QColor( 2 ) ) ), release_QBitmap ) ); + hb_retptrGC( gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createMaskFromColor( *hbqt_par_QColor( 2 ) ) ) ) ); } /* @@ -295,7 +303,7 @@ HB_FUNC( QT_QPIXMAP_LOADFROMDATA ) */ HB_FUNC( QT_QPIXMAP_MASK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBitmap( hbqt_par_QPixmap( 1 )->mask() ), release_QBitmap ) ); + hb_retptrGC( gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->mask() ) ) ); } /* @@ -303,7 +311,7 @@ HB_FUNC( QT_QPIXMAP_MASK ) */ HB_FUNC( QT_QPIXMAP_RECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPixmap( 1 )->rect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPixmap( 1 )->rect() ) ) ); } /* @@ -327,7 +335,7 @@ HB_FUNC( QT_QPIXMAP_SAVE_1 ) */ HB_FUNC( QT_QPIXMAP_SCALED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->scaled( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( Qt::AspectRatioMode ) hb_parni( 4 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 5 ) ? ( Qt::TransformationMode ) hb_parni( 5 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaled( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( Qt::AspectRatioMode ) hb_parni( 4 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 5 ) ? ( Qt::TransformationMode ) hb_parni( 5 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -335,7 +343,7 @@ HB_FUNC( QT_QPIXMAP_SCALED ) */ HB_FUNC( QT_QPIXMAP_SCALED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->scaled( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::AspectRatioMode ) hb_parni( 3 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 4 ) ? ( Qt::TransformationMode ) hb_parni( 4 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaled( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::AspectRatioMode ) hb_parni( 3 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 4 ) ? ( Qt::TransformationMode ) hb_parni( 4 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -343,7 +351,7 @@ HB_FUNC( QT_QPIXMAP_SCALED_1 ) */ HB_FUNC( QT_QPIXMAP_SCALEDTOHEIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->scaledToHeight( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaledToHeight( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -351,7 +359,7 @@ HB_FUNC( QT_QPIXMAP_SCALEDTOHEIGHT ) */ HB_FUNC( QT_QPIXMAP_SCALEDTOWIDTH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->scaledToWidth( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaledToWidth( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -375,7 +383,7 @@ HB_FUNC( QT_QPIXMAP_SETMASK ) */ HB_FUNC( QT_QPIXMAP_SIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QPixmap( 1 )->size() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QPixmap( 1 )->size() ) ) ); } /* @@ -383,7 +391,7 @@ HB_FUNC( QT_QPIXMAP_SIZE ) */ HB_FUNC( QT_QPIXMAP_TOIMAGE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QImage( hbqt_par_QPixmap( 1 )->toImage() ), release_QImage ) ); + hb_retptrGC( gcAllocate_QImage( new QImage( hbqt_par_QPixmap( 1 )->toImage() ) ) ); } /* @@ -391,7 +399,7 @@ HB_FUNC( QT_QPIXMAP_TOIMAGE ) */ HB_FUNC( QT_QPIXMAP_TRANSFORMED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->transformed( *hbqt_par_QTransform( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->transformed( *hbqt_par_QTransform( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -399,7 +407,7 @@ HB_FUNC( QT_QPIXMAP_TRANSFORMED ) */ HB_FUNC( QT_QPIXMAP_TRANSFORMED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); } /* @@ -423,7 +431,7 @@ HB_FUNC( QT_QPIXMAP_DEFAULTDEPTH ) */ HB_FUNC( QT_QPIXMAP_FROMIMAGE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) ) ); } /* @@ -431,7 +439,7 @@ HB_FUNC( QT_QPIXMAP_FROMIMAGE ) */ HB_FUNC( QT_QPIXMAP_GRABWIDGET ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->grabWidget( hbqt_par_QWidget( 2 ), *hbqt_par_QRect( 3 ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->grabWidget( hbqt_par_QWidget( 2 ), *hbqt_par_QRect( 3 ) ) ) ) ); } /* @@ -439,7 +447,7 @@ HB_FUNC( QT_QPIXMAP_GRABWIDGET ) */ HB_FUNC( QT_QPIXMAP_GRABWIDGET_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QPixmap( 1 )->grabWidget( hbqt_par_QWidget( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : -1 ), ( HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->grabWidget( hbqt_par_QWidget( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : -1 ), ( HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ) ) ) ) ); } /* @@ -447,7 +455,7 @@ HB_FUNC( QT_QPIXMAP_GRABWIDGET_1 ) */ HB_FUNC( QT_QPIXMAP_TRUEMATRIX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QPixmap( 1 )->trueMatrix( *hbqt_par_QTransform( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QPixmap( 1 )->trueMatrix( *hbqt_par_QTransform( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ) ) ); } /* @@ -455,7 +463,7 @@ HB_FUNC( QT_QPIXMAP_TRUEMATRIX ) */ HB_FUNC( QT_QPIXMAP_TRUEMATRIX_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QPixmap( 1 )->trueMatrix( *hbqt_par_QMatrix( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QPixmap( 1 )->trueMatrix( *hbqt_par_QMatrix( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPolygon.cpp b/harbour/contrib/hbqt/qtgui/QPolygon.cpp index f76d4c1338..f97a76de16 100644 --- a/harbour/contrib/hbqt/qtgui/QPolygon.cpp +++ b/harbour/contrib/hbqt/qtgui/QPolygon.cpp @@ -81,47 +81,55 @@ QT_G_FUNC( release_QPolygon ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPolygon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPolygon p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPolygon ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPolygon * ) ph )->~QPolygon(); - ph = NULL; + ( ( QPolygon * ) p->ph )->~QPolygon(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPolygon Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPolygon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPolygon" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPolygon Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPolygon" ); + #endif } } +void * gcAllocate_QPolygon( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPolygon; + #if defined(__debug__) + just_debug( " new_QPolygon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPOLYGON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPolygon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QPolygon() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPolygon; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPolygon( pObj ) ); } /* * QRect boundingRect () const */ HB_FUNC( QT_QPOLYGON_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPolygon( 1 )->boundingRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPolygon( 1 )->boundingRect() ) ) ); } /* @@ -137,7 +145,7 @@ HB_FUNC( QT_QPOLYGON_CONTAINSPOINT ) */ HB_FUNC( QT_QPOLYGON_INTERSECTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygon( hbqt_par_QPolygon( 1 )->intersected( *hbqt_par_QPolygon( 2 ) ) ), release_QPolygon ) ); + hb_retptrGC( gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->intersected( *hbqt_par_QPolygon( 2 ) ) ) ) ); } /* @@ -159,7 +167,7 @@ HB_FUNC( QT_QPOLYGON_POINT ) */ HB_FUNC( QT_QPOLYGON_POINT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QPolygon( 1 )->point( hb_parni( 2 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QPolygon( 1 )->point( hb_parni( 2 ) ) ) ) ); } /* @@ -203,7 +211,7 @@ HB_FUNC( QT_QPOLYGON_SETPOINTS ) */ HB_FUNC( QT_QPOLYGON_SUBTRACTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygon( hbqt_par_QPolygon( 1 )->subtracted( *hbqt_par_QPolygon( 2 ) ) ), release_QPolygon ) ); + hb_retptrGC( gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->subtracted( *hbqt_par_QPolygon( 2 ) ) ) ) ); } /* @@ -227,7 +235,7 @@ HB_FUNC( QT_QPOLYGON_TRANSLATE_1 ) */ HB_FUNC( QT_QPOLYGON_UNITED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygon( hbqt_par_QPolygon( 1 )->united( *hbqt_par_QPolygon( 2 ) ) ), release_QPolygon ) ); + hb_retptrGC( gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->united( *hbqt_par_QPolygon( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPolygonF.cpp b/harbour/contrib/hbqt/qtgui/QPolygonF.cpp index 38991015ea..46f98baaac 100644 --- a/harbour/contrib/hbqt/qtgui/QPolygonF.cpp +++ b/harbour/contrib/hbqt/qtgui/QPolygonF.cpp @@ -82,47 +82,55 @@ QT_G_FUNC( release_QPolygonF ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPolygonF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPolygonF p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPolygonF ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPolygonF * ) ph )->~QPolygonF(); - ph = NULL; + ( ( QPolygonF * ) p->ph )->~QPolygonF(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPolygonF Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPolygonF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPolygonF" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPolygonF Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPolygonF" ); + #endif } } +void * gcAllocate_QPolygonF( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPolygonF; + #if defined(__debug__) + just_debug( " new_QPolygonF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPOLYGONF ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPolygonF %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QPolygonF() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPolygonF; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPolygonF( pObj ) ); } /* * QRectF boundingRect () const */ HB_FUNC( QT_QPOLYGONF_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QPolygonF( 1 )->boundingRect() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QPolygonF( 1 )->boundingRect() ) ) ); } /* @@ -138,7 +146,7 @@ HB_FUNC( QT_QPOLYGONF_CONTAINSPOINT ) */ HB_FUNC( QT_QPOLYGONF_INTERSECTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygonF( hbqt_par_QPolygonF( 1 )->intersected( *hbqt_par_QPolygonF( 2 ) ) ), release_QPolygonF ) ); + hb_retptrGC( gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->intersected( *hbqt_par_QPolygonF( 2 ) ) ) ) ); } /* @@ -154,7 +162,7 @@ HB_FUNC( QT_QPOLYGONF_ISCLOSED ) */ HB_FUNC( QT_QPOLYGONF_SUBTRACTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygonF( hbqt_par_QPolygonF( 1 )->subtracted( *hbqt_par_QPolygonF( 2 ) ) ), release_QPolygonF ) ); + hb_retptrGC( gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->subtracted( *hbqt_par_QPolygonF( 2 ) ) ) ) ); } /* @@ -162,7 +170,7 @@ HB_FUNC( QT_QPOLYGONF_SUBTRACTED ) */ HB_FUNC( QT_QPOLYGONF_TOPOLYGON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygon( hbqt_par_QPolygonF( 1 )->toPolygon() ), release_QPolygon ) ); + hb_retptrGC( gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygonF( 1 )->toPolygon() ) ) ); } /* @@ -186,7 +194,7 @@ HB_FUNC( QT_QPOLYGONF_TRANSLATE_1 ) */ HB_FUNC( QT_QPOLYGONF_UNITED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygonF( hbqt_par_QPolygonF( 1 )->united( *hbqt_par_QPolygonF( 2 ) ) ), release_QPolygonF ) ); + hb_retptrGC( gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->united( *hbqt_par_QPolygonF( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPrintDialog.cpp b/harbour/contrib/hbqt/qtgui/QPrintDialog.cpp index 469a8fc9ab..21538bf3ac 100644 --- a/harbour/contrib/hbqt/qtgui/QPrintDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QPrintDialog.cpp @@ -82,52 +82,69 @@ * ~QPrintDialog () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QPrintDialog > pq; +} QGC_POINTER_QPrintDialog; + QT_G_FUNC( release_QPrintDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPrintDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QPrintDialog * p = ( QGC_POINTER_QPrintDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QPrintDialog * ) ph )->~QPrintDialog(); - ph = NULL; + ( ( QPrintDialog * ) p->ph )->~QPrintDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPrintDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QPrintDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QPrintDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPrintDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPrintDialog" ); + #endif } } +void * gcAllocate_QPrintDialog( void * pObj ) +{ + QGC_POINTER_QPrintDialog * p = ( QGC_POINTER_QPrintDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QPrintDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPrintDialog; + new( & p->pq ) QPointer< QPrintDialog >( ( QPrintDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QPrintDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPRINTDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QPrintDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPrintDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QPrintDialog* ) new QPrintDialog ( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPrintDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPrintDialog( pObj ) ); } /* * virtual void done ( int result ) diff --git a/harbour/contrib/hbqt/qtgui/QPrintEngine.cpp b/harbour/contrib/hbqt/qtgui/QPrintEngine.cpp index 42007e3203..5cd9fe641d 100644 --- a/harbour/contrib/hbqt/qtgui/QPrintEngine.cpp +++ b/harbour/contrib/hbqt/qtgui/QPrintEngine.cpp @@ -81,31 +81,7 @@ QT_G_FUNC( release_QPrintEngine ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPrintEngine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QPrintEngine * ) ph )->~QPrintEngine(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QPrintEngine" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPrintEngine" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QPRINTENGINE ) @@ -148,7 +124,7 @@ HB_FUNC( QT_QPRINTENGINE_PRINTERSTATE ) */ HB_FUNC( QT_QPRINTENGINE_PROPERTY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QPrintEngine( 1 )->property( ( QPrintEngine::PrintEnginePropertyKey ) hb_parni( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QPrintEngine( 1 )->property( ( QPrintEngine::PrintEnginePropertyKey ) hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPrintPreviewDialog.cpp b/harbour/contrib/hbqt/qtgui/QPrintPreviewDialog.cpp index 341b9de99e..bb712e536b 100644 --- a/harbour/contrib/hbqt/qtgui/QPrintPreviewDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QPrintPreviewDialog.cpp @@ -77,55 +77,72 @@ * ~QPrintPreviewDialog () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QPrintPreviewDialog > pq; +} QGC_POINTER_QPrintPreviewDialog; + QT_G_FUNC( release_QPrintPreviewDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPrintPreviewDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QPrintPreviewDialog * p = ( QGC_POINTER_QPrintPreviewDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintPreviewDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintPreviewDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QPrintPreviewDialog * ) ph )->~QPrintPreviewDialog(); - ph = NULL; + ( ( QPrintPreviewDialog * ) p->ph )->~QPrintPreviewDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintPreviewDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPrintPreviewDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QPrintPreviewDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintPreviewDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QPrintPreviewDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPrintPreviewDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPrintPreviewDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPrintPreviewDialog" ); + #endif } } +void * gcAllocate_QPrintPreviewDialog( void * pObj ) +{ + QGC_POINTER_QPrintPreviewDialog * p = ( QGC_POINTER_QPrintPreviewDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QPrintPreviewDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPrintPreviewDialog; + new( & p->pq ) QPointer< QPrintPreviewDialog >( ( QPrintPreviewDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QPrintPreviewDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPRINTPREVIEWDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QPrintPreviewDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPrintPreviewDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 2 && HB_ISPOINTER( 2 ) ) pObj = new QPrintPreviewDialog( hbqt_par_QPrinter( 1 ), hbqt_par_QWidget( 2 ), ( Qt::WindowFlags ) hb_parni( 3 ) ) ; else pObj = new QPrintPreviewDialog( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPrintPreviewDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPrintPreviewDialog( pObj ) ); } /* * void open ( QObject * receiver, const char * member ) diff --git a/harbour/contrib/hbqt/qtgui/QPrinter.cpp b/harbour/contrib/hbqt/qtgui/QPrinter.cpp index 40b13564e0..49cc4b804b 100644 --- a/harbour/contrib/hbqt/qtgui/QPrinter.cpp +++ b/harbour/contrib/hbqt/qtgui/QPrinter.cpp @@ -110,40 +110,48 @@ QT_G_FUNC( release_QPrinter ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPrinter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPrinter p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QPrinter ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QPrinter * ) ph )->~QPrinter(); - ph = NULL; + ( ( QPrinter * ) p->ph )->~QPrinter(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPrinter Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPrinter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPrinter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPrinter Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPrinter" ); + #endif } } +void * gcAllocate_QPrinter( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPrinter; + #if defined(__debug__) + just_debug( " new_QPrinter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPRINTER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPrinter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QPrinter* ) new QPrinter() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPrinter; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPrinter( pObj ) ); } /* * bool abort () @@ -304,7 +312,7 @@ HB_FUNC( QT_QPRINTER_PAGEORDER ) */ HB_FUNC( QT_QPRINTER_PAGERECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPrinter( 1 )->pageRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPrinter( 1 )->pageRect() ) ) ); } /* @@ -312,7 +320,7 @@ HB_FUNC( QT_QPRINTER_PAGERECT ) */ HB_FUNC( QT_QPRINTER_PAGERECT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QPrinter( 1 )->pageRect( ( QPrinter::Unit ) hb_parni( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QPrinter( 1 )->pageRect( ( QPrinter::Unit ) hb_parni( 2 ) ) ) ) ); } /* @@ -328,7 +336,7 @@ HB_FUNC( QT_QPRINTER_PAINTENGINE ) */ HB_FUNC( QT_QPRINTER_PAPERRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QPrinter( 1 )->paperRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QPrinter( 1 )->paperRect() ) ) ); } /* @@ -336,7 +344,7 @@ HB_FUNC( QT_QPRINTER_PAPERRECT ) */ HB_FUNC( QT_QPRINTER_PAPERRECT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QPrinter( 1 )->paperRect( ( QPrinter::Unit ) hb_parni( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QPrinter( 1 )->paperRect( ( QPrinter::Unit ) hb_parni( 2 ) ) ) ) ); } /* @@ -352,7 +360,7 @@ HB_FUNC( QT_QPRINTER_PAPERSIZE ) */ HB_FUNC( QT_QPRINTER_PAPERSIZE_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QPrinter( 1 )->paperSize( ( QPrinter::Unit ) hb_parni( 2 ) ) ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QPrinter( 1 )->paperSize( ( QPrinter::Unit ) hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QProgressBar.cpp b/harbour/contrib/hbqt/qtgui/QProgressBar.cpp index 1871676fd2..20edfe5f8f 100644 --- a/harbour/contrib/hbqt/qtgui/QProgressBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QProgressBar.cpp @@ -79,52 +79,69 @@ * QProgressBar ( QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QProgressBar > pq; +} QGC_POINTER_QProgressBar; + QT_G_FUNC( release_QProgressBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QProgressBar * p = ( QGC_POINTER_QProgressBar * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressBar p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressBar ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QProgressBar * ) ph )->~QProgressBar(); - ph = NULL; + ( ( QProgressBar * ) p->ph )->~QProgressBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QProgressBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressBar Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QProgressBar" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QProgressBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QProgressBar" ); + #endif } } +void * gcAllocate_QProgressBar( void * pObj ) +{ + QGC_POINTER_QProgressBar * p = ( QGC_POINTER_QProgressBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QProgressBar ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QProgressBar; + new( & p->pq ) QPointer< QProgressBar >( ( QProgressBar * ) pObj ); + #if defined(__debug__) + just_debug( " new_QProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPROGRESSBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QProgressBar > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QProgressBar* ) new QProgressBar( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QProgressBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QProgressBar( pObj ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QProgressDialog.cpp b/harbour/contrib/hbqt/qtgui/QProgressDialog.cpp index bde99c703e..0652548116 100644 --- a/harbour/contrib/hbqt/qtgui/QProgressDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QProgressDialog.cpp @@ -77,52 +77,69 @@ * ~QProgressDialog () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QProgressDialog > pq; +} QGC_POINTER_QProgressDialog; + QT_G_FUNC( release_QProgressDialog ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QProgressDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QProgressDialog * p = ( QGC_POINTER_QProgressDialog * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressDialog p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QProgressDialog * ) ph )->~QProgressDialog(); - ph = NULL; + ( ( QProgressDialog * ) p->ph )->~QProgressDialog(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressDialog Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QProgressDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QProgressDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressDialog Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QProgressDialog" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QProgressDialog" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QProgressDialog Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QProgressDialog" ); + #endif } } +void * gcAllocate_QProgressDialog( void * pObj ) +{ + QGC_POINTER_QProgressDialog * p = ( QGC_POINTER_QProgressDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QProgressDialog ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QProgressDialog; + new( & p->pq ) QPointer< QProgressDialog >( ( QProgressDialog * ) pObj ); + #if defined(__debug__) + just_debug( " new_QProgressDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPROGRESSDIALOG ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QProgressDialog > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QProgressDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QProgressDialog( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QProgressDialog; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QProgressDialog( pObj ) ); } /* * bool autoClose () const @@ -225,7 +242,7 @@ HB_FUNC( QT_QPROGRESSDIALOG_SETLABEL ) */ HB_FUNC( QT_QPROGRESSDIALOG_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QProgressDialog( 1 )->sizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QProgressDialog( 1 )->sizeHint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPushButton.cpp b/harbour/contrib/hbqt/qtgui/QPushButton.cpp index 8d10d7a579..e3e96117b6 100644 --- a/harbour/contrib/hbqt/qtgui/QPushButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QPushButton.cpp @@ -78,52 +78,69 @@ * ~QPushButton () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QPushButton > pq; +} QGC_POINTER_QPushButton; + QT_G_FUNC( release_QPushButton ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QPushButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QPushButton * p = ( QGC_POINTER_QPushButton * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QPushButton p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QPushButton ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QPushButton * ) ph )->~QPushButton(); - ph = NULL; + ( ( QPushButton * ) p->ph )->~QPushButton(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QPushButton Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QPushButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QPushButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPushButton Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QPushButton" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QPushButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QPushButton Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QPushButton" ); + #endif } } +void * gcAllocate_QPushButton( void * pObj ) +{ + QGC_POINTER_QPushButton * p = ( QGC_POINTER_QPushButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QPushButton ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QPushButton; + new( & p->pq ) QPointer< QPushButton >( ( QPushButton * ) pObj ); + #if defined(__debug__) + just_debug( " new_QPushButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QPUSHBUTTON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QPushButton > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QPushButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QPushButton* ) new QPushButton( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QPushButton; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QPushButton( pObj ) ); } /* * bool autoDefault () const diff --git a/harbour/contrib/hbqt/qtgui/QRadialGradient.cpp b/harbour/contrib/hbqt/qtgui/QRadialGradient.cpp index 01f7a2a1af..3dda791012 100644 --- a/harbour/contrib/hbqt/qtgui/QRadialGradient.cpp +++ b/harbour/contrib/hbqt/qtgui/QRadialGradient.cpp @@ -87,30 +87,44 @@ QT_G_FUNC( release_QRadialGradient ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QRadialGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QRadialGradient p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QRadialGradient ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QRadialGradient * ) ph )->~QRadialGradient(); - ph = NULL; + ( ( QRadialGradient * ) p->ph )->~QRadialGradient(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QRadialGradient Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QRadialGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QRadialGradient" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QRadialGradient Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QRadialGradient" ); + #endif } } +void * gcAllocate_QRadialGradient( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QRadialGradient; + #if defined(__debug__) + just_debug( " new_QRadialGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QRADIALGRADIENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QRadialGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -133,20 +147,14 @@ hb_snprintf( str, sizeof(str), " GC: new QRadialGradient %i B %i pObj = ( QRadialGradient* ) new QRadialGradient() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QRadialGradient; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QRadialGradient( pObj ) ); } /* * QPointF center () const */ HB_FUNC( QT_QRADIALGRADIENT_CENTER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QRadialGradient( 1 )->center() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QRadialGradient( 1 )->center() ) ) ); } /* @@ -154,7 +162,7 @@ HB_FUNC( QT_QRADIALGRADIENT_CENTER ) */ HB_FUNC( QT_QRADIALGRADIENT_FOCALPOINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QRadialGradient( 1 )->focalPoint() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QRadialGradient( 1 )->focalPoint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QRadioButton.cpp b/harbour/contrib/hbqt/qtgui/QRadioButton.cpp index 3dfd46a623..e6cf901964 100644 --- a/harbour/contrib/hbqt/qtgui/QRadioButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QRadioButton.cpp @@ -76,55 +76,72 @@ * QRadioButton ( const QString & text, QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QRadioButton > pq; +} QGC_POINTER_QRadioButton; + QT_G_FUNC( release_QRadioButton ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QRadioButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QRadioButton * p = ( QGC_POINTER_QRadioButton * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QRadioButton p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QRadioButton ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QRadioButton * ) ph )->~QRadioButton(); - ph = NULL; + ( ( QRadioButton * ) p->ph )->~QRadioButton(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QRadioButton Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QRadioButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QRadioButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QRadioButton Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QRadioButton" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QRadioButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QRadioButton Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QRadioButton" ); + #endif } } +void * gcAllocate_QRadioButton( void * pObj ) +{ + QGC_POINTER_QRadioButton * p = ( QGC_POINTER_QRadioButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QRadioButton ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QRadioButton; + new( & p->pq ) QPointer< QRadioButton >( ( QRadioButton * ) pObj ); + #if defined(__debug__) + just_debug( " new_QRadioButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QRADIOBUTTON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QRadioButton > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QRadioButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( HB_ISCHAR( 1 ) ) pObj = ( QRadioButton* ) new QRadioButton( hbqt_par_QString( 1 ), hbqt_par_QWidget( 2 ) ) ; else pObj = ( QRadioButton* ) new QRadioButton( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QRadioButton; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QRadioButton( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QRegion.cpp b/harbour/contrib/hbqt/qtgui/QRegion.cpp index 6ec0c04943..47b22e562b 100644 --- a/harbour/contrib/hbqt/qtgui/QRegion.cpp +++ b/harbour/contrib/hbqt/qtgui/QRegion.cpp @@ -100,30 +100,44 @@ QT_G_FUNC( release_QRegion ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QRegion %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QRegion p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QRegion ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QRegion * ) ph )->~QRegion(); - ph = NULL; + ( ( QRegion * ) p->ph )->~QRegion(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QRegion Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QRegion %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QRegion" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QRegion Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QRegion" ); + #endif } } +void * gcAllocate_QRegion( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QRegion; + #if defined(__debug__) + just_debug( " new_QRegion %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QREGION ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QRegion %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -161,20 +175,14 @@ hb_snprintf( str, sizeof(str), " GC: new QRegion %i B %i pObj = ( QRegion* ) new QRegion() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QRegion; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QRegion( pObj ) ); } /* * QRect boundingRect () const */ HB_FUNC( QT_QREGION_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QRegion( 1 )->boundingRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QRegion( 1 )->boundingRect() ) ) ); } /* @@ -198,7 +206,7 @@ HB_FUNC( QT_QREGION_CONTAINS_1 ) */ HB_FUNC( QT_QREGION_INTERSECTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QRegion( 1 )->intersected( *hbqt_par_QRegion( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->intersected( *hbqt_par_QRegion( 2 ) ) ) ) ); } /* @@ -206,7 +214,7 @@ HB_FUNC( QT_QREGION_INTERSECTED ) */ HB_FUNC( QT_QREGION_INTERSECTED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QRegion( 1 )->intersected( *hbqt_par_QRect( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->intersected( *hbqt_par_QRect( 2 ) ) ) ) ); } /* @@ -254,7 +262,7 @@ HB_FUNC( QT_QREGION_SETRECTS ) */ HB_FUNC( QT_QREGION_SUBTRACTED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QRegion( 1 )->subtracted( *hbqt_par_QRegion( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->subtracted( *hbqt_par_QRegion( 2 ) ) ) ) ); } /* @@ -278,7 +286,7 @@ HB_FUNC( QT_QREGION_TRANSLATE_1 ) */ HB_FUNC( QT_QREGION_TRANSLATED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QRegion( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -286,7 +294,7 @@ HB_FUNC( QT_QREGION_TRANSLATED ) */ HB_FUNC( QT_QREGION_TRANSLATED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QRegion( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -294,7 +302,7 @@ HB_FUNC( QT_QREGION_TRANSLATED_1 ) */ HB_FUNC( QT_QREGION_UNITED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QRegion( 1 )->united( *hbqt_par_QRegion( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->united( *hbqt_par_QRegion( 2 ) ) ) ) ); } /* @@ -302,7 +310,7 @@ HB_FUNC( QT_QREGION_UNITED ) */ HB_FUNC( QT_QREGION_UNITED_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QRegion( 1 )->united( *hbqt_par_QRect( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->united( *hbqt_par_QRect( 2 ) ) ) ) ); } /* @@ -310,7 +318,7 @@ HB_FUNC( QT_QREGION_UNITED_1 ) */ HB_FUNC( QT_QREGION_XORED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QRegion( 1 )->xored( *hbqt_par_QRegion( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->xored( *hbqt_par_QRegion( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QResizeEvent.cpp b/harbour/contrib/hbqt/qtgui/QResizeEvent.cpp index 4bfa19dd4c..2f48968d08 100644 --- a/harbour/contrib/hbqt/qtgui/QResizeEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QResizeEvent.cpp @@ -77,31 +77,7 @@ QT_G_FUNC( release_QResizeEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QResizeEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QResizeEvent * ) ph )->~QResizeEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QResizeEvent" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QResizeEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QRESIZEEVENT ) @@ -112,7 +88,7 @@ HB_FUNC( QT_QRESIZEEVENT ) */ HB_FUNC( QT_QRESIZEEVENT_OLDSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QResizeEvent( 1 )->oldSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QResizeEvent( 1 )->oldSize() ) ) ); } /* @@ -120,7 +96,7 @@ HB_FUNC( QT_QRESIZEEVENT_OLDSIZE ) */ HB_FUNC( QT_QRESIZEEVENT_SIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QResizeEvent( 1 )->size() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QResizeEvent( 1 )->size() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QScrollArea.cpp b/harbour/contrib/hbqt/qtgui/QScrollArea.cpp index 0eae397af1..87761706a3 100644 --- a/harbour/contrib/hbqt/qtgui/QScrollArea.cpp +++ b/harbour/contrib/hbqt/qtgui/QScrollArea.cpp @@ -76,52 +76,69 @@ * ~QScrollArea () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QScrollArea > pq; +} QGC_POINTER_QScrollArea; + QT_G_FUNC( release_QScrollArea ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QScrollArea %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QScrollArea * p = ( QGC_POINTER_QScrollArea * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollArea p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollArea ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QScrollArea * ) ph )->~QScrollArea(); - ph = NULL; + ( ( QScrollArea * ) p->ph )->~QScrollArea(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollArea Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QScrollArea %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QScrollArea" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollArea Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QScrollArea" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QScrollArea" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollArea Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QScrollArea" ); + #endif } } +void * gcAllocate_QScrollArea( void * pObj ) +{ + QGC_POINTER_QScrollArea * p = ( QGC_POINTER_QScrollArea * ) hb_gcAllocate( sizeof( QGC_POINTER_QScrollArea ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QScrollArea; + new( & p->pq ) QPointer< QScrollArea >( ( QScrollArea * ) pObj ); + #if defined(__debug__) + just_debug( " new_QScrollArea %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSCROLLAREA ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QScrollArea > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QScrollArea %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QScrollArea* ) new QScrollArea( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QScrollArea; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QScrollArea( pObj ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QScrollBar.cpp b/harbour/contrib/hbqt/qtgui/QScrollBar.cpp index 45bf7f6b51..dec3020711 100644 --- a/harbour/contrib/hbqt/qtgui/QScrollBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QScrollBar.cpp @@ -77,52 +77,69 @@ * ~QScrollBar () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QScrollBar > pq; +} QGC_POINTER_QScrollBar; + QT_G_FUNC( release_QScrollBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QScrollBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QScrollBar * p = ( QGC_POINTER_QScrollBar * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollBar p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollBar ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QScrollBar * ) ph )->~QScrollBar(); - ph = NULL; + ( ( QScrollBar * ) p->ph )->~QScrollBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QScrollBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QScrollBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollBar Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QScrollBar" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QScrollBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QScrollBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QScrollBar" ); + #endif } } +void * gcAllocate_QScrollBar( void * pObj ) +{ + QGC_POINTER_QScrollBar * p = ( QGC_POINTER_QScrollBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QScrollBar ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QScrollBar; + new( & p->pq ) QPointer< QScrollBar >( ( QScrollBar * ) pObj ); + #if defined(__debug__) + just_debug( " new_QScrollBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSCROLLBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QScrollBar > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QScrollBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QScrollBar* ) new QScrollBar( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QScrollBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QScrollBar( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QSessionManager.cpp b/harbour/contrib/hbqt/qtgui/QSessionManager.cpp index ea54177d7e..2d90479df9 100644 --- a/harbour/contrib/hbqt/qtgui/QSessionManager.cpp +++ b/harbour/contrib/hbqt/qtgui/QSessionManager.cpp @@ -116,7 +116,7 @@ HB_FUNC( QT_QSESSIONMANAGER_CANCEL ) */ HB_FUNC( QT_QSESSIONMANAGER_DISCARDCOMMAND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QSessionManager( 1 )->discardCommand() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QSessionManager( 1 )->discardCommand() ) ) ); } /* @@ -148,7 +148,7 @@ HB_FUNC( QT_QSESSIONMANAGER_REQUESTPHASE2 ) */ HB_FUNC( QT_QSESSIONMANAGER_RESTARTCOMMAND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QSessionManager( 1 )->restartCommand() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QSessionManager( 1 )->restartCommand() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QSizeGrip.cpp b/harbour/contrib/hbqt/qtgui/QSizeGrip.cpp index b5b3823e3f..55a924ec40 100644 --- a/harbour/contrib/hbqt/qtgui/QSizeGrip.cpp +++ b/harbour/contrib/hbqt/qtgui/QSizeGrip.cpp @@ -76,52 +76,69 @@ * ~QSizeGrip () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSizeGrip > pq; +} QGC_POINTER_QSizeGrip; + QT_G_FUNC( release_QSizeGrip ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QSizeGrip * p = ( QGC_POINTER_QSizeGrip * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeGrip p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeGrip ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QSizeGrip * ) ph )->~QSizeGrip(); - ph = NULL; + ( ( QSizeGrip * ) p->ph )->~QSizeGrip(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeGrip Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QSizeGrip" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeGrip Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QSizeGrip" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSizeGrip" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSizeGrip Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSizeGrip" ); + #endif } } +void * gcAllocate_QSizeGrip( void * pObj ) +{ + QGC_POINTER_QSizeGrip * p = ( QGC_POINTER_QSizeGrip * ) hb_gcAllocate( sizeof( QGC_POINTER_QSizeGrip ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSizeGrip; + new( & p->pq ) QPointer< QSizeGrip >( ( QSizeGrip * ) pObj ); + #if defined(__debug__) + just_debug( " new_QSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSIZEGRIP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QSizeGrip > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QSizeGrip* ) new QSizeGrip( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSizeGrip; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSizeGrip( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QSizePolicy.cpp b/harbour/contrib/hbqt/qtgui/QSizePolicy.cpp index 2505568bde..da6faa5b91 100644 --- a/harbour/contrib/hbqt/qtgui/QSizePolicy.cpp +++ b/harbour/contrib/hbqt/qtgui/QSizePolicy.cpp @@ -86,40 +86,48 @@ QT_G_FUNC( release_QSizePolicy ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSizePolicy %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSizePolicy p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QSizePolicy ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QSizePolicy * ) ph )->~QSizePolicy(); - ph = NULL; + ( ( QSizePolicy * ) p->ph )->~QSizePolicy(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSizePolicy Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSizePolicy %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSizePolicy" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSizePolicy Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSizePolicy" ); + #endif } } +void * gcAllocate_QSizePolicy( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSizePolicy; + #if defined(__debug__) + just_debug( " new_QSizePolicy %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSIZEPOLICY ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSizePolicy %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QSizePolicy* ) new QSizePolicy() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSizePolicy; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSizePolicy( pObj ) ); } /* * ControlType controlType () const diff --git a/harbour/contrib/hbqt/qtgui/QSlider.cpp b/harbour/contrib/hbqt/qtgui/QSlider.cpp index 4f08f992c4..f4735b648f 100644 --- a/harbour/contrib/hbqt/qtgui/QSlider.cpp +++ b/harbour/contrib/hbqt/qtgui/QSlider.cpp @@ -81,55 +81,72 @@ * ~QSlider () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSlider > pq; +} QGC_POINTER_QSlider; + QT_G_FUNC( release_QSlider ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QSlider * p = ( QGC_POINTER_QSlider * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSlider p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QSlider ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QSlider * ) ph )->~QSlider(); - ph = NULL; + ( ( QSlider * ) p->ph )->~QSlider(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSlider Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QSlider" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSlider Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QSlider" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSlider" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSlider Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSlider" ); + #endif } } +void * gcAllocate_QSlider( void * pObj ) +{ + QGC_POINTER_QSlider * p = ( QGC_POINTER_QSlider * ) hb_gcAllocate( sizeof( QGC_POINTER_QSlider ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSlider; + new( & p->pq ) QPointer< QSlider >( ( QSlider * ) pObj ); + #if defined(__debug__) + just_debug( " new_QSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSLIDER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QSlider > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 1 && HB_ISNUM( 1 ) ) pObj = ( QSlider* ) new QSlider( ( Qt::Orientation ) hb_parni( 1 ), hbqt_par_QWidget( 2 ) ) ; else pObj = ( QSlider* ) new QSlider( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSlider; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSlider( pObj ) ); } /* * void setTickInterval ( int ti ) diff --git a/harbour/contrib/hbqt/qtgui/QSound.cpp b/harbour/contrib/hbqt/qtgui/QSound.cpp index 6429bdc6cb..2a22a10ed3 100644 --- a/harbour/contrib/hbqt/qtgui/QSound.cpp +++ b/harbour/contrib/hbqt/qtgui/QSound.cpp @@ -76,52 +76,69 @@ * ~QSound () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSound > pq; +} QGC_POINTER_QSound; + QT_G_FUNC( release_QSound ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSound %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QSound * p = ( QGC_POINTER_QSound * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSound p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QSound ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QSound * ) ph )->~QSound(); - ph = NULL; + ( ( QSound * ) p->ph )->~QSound(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSound Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSound %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QSound" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSound Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QSound" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSound" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSound Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSound" ); + #endif } } +void * gcAllocate_QSound( void * pObj ) +{ + QGC_POINTER_QSound * p = ( QGC_POINTER_QSound * ) hb_gcAllocate( sizeof( QGC_POINTER_QSound ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSound; + new( & p->pq ) QPointer< QSound >( ( QSound * ) pObj ); + #if defined(__debug__) + just_debug( " new_QSound %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSOUND ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QSound > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSound %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QSound* ) new QSound( hbqt_par_QString( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSound; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSound( pObj ) ); } /* * QString fileName () const diff --git a/harbour/contrib/hbqt/qtgui/QSpacerItem.cpp b/harbour/contrib/hbqt/qtgui/QSpacerItem.cpp index 87ed573ec7..118ffdb0a2 100644 --- a/harbour/contrib/hbqt/qtgui/QSpacerItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QSpacerItem.cpp @@ -77,43 +77,51 @@ QT_G_FUNC( release_QSpacerItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSpacerItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSpacerItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QSpacerItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QSpacerItem * ) ph )->~QSpacerItem(); - ph = NULL; + ( ( QSpacerItem * ) p->ph )->~QSpacerItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSpacerItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSpacerItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSpacerItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSpacerItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSpacerItem" ); + #endif } } +void * gcAllocate_QSpacerItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSpacerItem; + #if defined(__debug__) + just_debug( " new_QSpacerItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSPACERITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSpacerItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { pObj = new QSpacerItem( *hbqt_par_QSpacerItem( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSpacerItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSpacerItem( pObj ) ); } /* * void changeSize ( int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum ) diff --git a/harbour/contrib/hbqt/qtgui/QSpinBox.cpp b/harbour/contrib/hbqt/qtgui/QSpinBox.cpp index 93b35cb53e..be939ed116 100644 --- a/harbour/contrib/hbqt/qtgui/QSpinBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QSpinBox.cpp @@ -75,52 +75,69 @@ * QSpinBox ( QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSpinBox > pq; +} QGC_POINTER_QSpinBox; + QT_G_FUNC( release_QSpinBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QSpinBox * p = ( QGC_POINTER_QSpinBox * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSpinBox p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QSpinBox ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QSpinBox * ) ph )->~QSpinBox(); - ph = NULL; + ( ( QSpinBox * ) p->ph )->~QSpinBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSpinBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QSpinBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSpinBox Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QSpinBox" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSpinBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSpinBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSpinBox" ); + #endif } } +void * gcAllocate_QSpinBox( void * pObj ) +{ + QGC_POINTER_QSpinBox * p = ( QGC_POINTER_QSpinBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QSpinBox ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSpinBox; + new( & p->pq ) QPointer< QSpinBox >( ( QSpinBox * ) pObj ); + #if defined(__debug__) + just_debug( " new_QSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSPINBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QSpinBox > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QSpinBox* ) new QSpinBox( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSpinBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSpinBox( pObj ) ); } /* * QString cleanText () const diff --git a/harbour/contrib/hbqt/qtgui/QSplashScreen.cpp b/harbour/contrib/hbqt/qtgui/QSplashScreen.cpp index 0a9a338540..7de6c720a5 100644 --- a/harbour/contrib/hbqt/qtgui/QSplashScreen.cpp +++ b/harbour/contrib/hbqt/qtgui/QSplashScreen.cpp @@ -77,52 +77,69 @@ * virtual ~QSplashScreen () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSplashScreen > pq; +} QGC_POINTER_QSplashScreen; + QT_G_FUNC( release_QSplashScreen ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSplashScreen %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QSplashScreen * p = ( QGC_POINTER_QSplashScreen * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSplashScreen p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QSplashScreen ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QSplashScreen * ) ph )->~QSplashScreen(); - ph = NULL; + ( ( QSplashScreen * ) p->ph )->~QSplashScreen(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSplashScreen Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSplashScreen %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QSplashScreen" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSplashScreen Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QSplashScreen" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSplashScreen" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSplashScreen Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSplashScreen" ); + #endif } } +void * gcAllocate_QSplashScreen( void * pObj ) +{ + QGC_POINTER_QSplashScreen * p = ( QGC_POINTER_QSplashScreen * ) hb_gcAllocate( sizeof( QGC_POINTER_QSplashScreen ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSplashScreen; + new( & p->pq ) QPointer< QSplashScreen >( ( QSplashScreen * ) pObj ); + #if defined(__debug__) + just_debug( " new_QSplashScreen %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSPLASHSCREEN ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QSplashScreen > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSplashScreen %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QSplashScreen( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSplashScreen; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSplashScreen( pObj ) ); } /* * void finish ( QWidget * mainWin ) @@ -137,7 +154,7 @@ HB_FUNC( QT_QSPLASHSCREEN_FINISH ) */ HB_FUNC( QT_QSPLASHSCREEN_PIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QSplashScreen( 1 )->pixmap() ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QSplashScreen( 1 )->pixmap() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QSplitter.cpp b/harbour/contrib/hbqt/qtgui/QSplitter.cpp index cfdad64519..6904a2c98f 100644 --- a/harbour/contrib/hbqt/qtgui/QSplitter.cpp +++ b/harbour/contrib/hbqt/qtgui/QSplitter.cpp @@ -87,55 +87,72 @@ * ~QSplitter () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSplitter > pq; +} QGC_POINTER_QSplitter; + QT_G_FUNC( release_QSplitter ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSplitter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QSplitter * p = ( QGC_POINTER_QSplitter * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSplitter p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QSplitter ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QSplitter * ) ph )->~QSplitter(); - ph = NULL; + ( ( QSplitter * ) p->ph )->~QSplitter(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSplitter Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSplitter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QSplitter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSplitter Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QSplitter" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSplitter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSplitter Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSplitter" ); + #endif } } +void * gcAllocate_QSplitter( void * pObj ) +{ + QGC_POINTER_QSplitter * p = ( QGC_POINTER_QSplitter * ) hb_gcAllocate( sizeof( QGC_POINTER_QSplitter ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSplitter; + new( & p->pq ) QPointer< QSplitter >( ( QSplitter * ) pObj ); + #if defined(__debug__) + just_debug( " new_QSplitter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSPLITTER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QSplitter > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSplitter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 1 && HB_ISNUM( 1 ) ) pObj = ( QSplitter* ) new QSplitter( ( Qt::Orientation ) hb_parni( 1 ), hbqt_par_QWidget( 2 ) ) ; else pObj = ( QSplitter* ) new QSplitter( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSplitter; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSplitter( pObj ) ); } /* * void addWidget ( QWidget * widget ) @@ -252,7 +269,7 @@ HB_FUNC( QT_QSPLITTER_RESTORESTATE ) */ HB_FUNC( QT_QSPLITTER_SAVESTATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QSplitter( 1 )->saveState() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QSplitter( 1 )->saveState() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStandardItem.cpp b/harbour/contrib/hbqt/qtgui/QStandardItem.cpp index 6dfb819b81..3acd2a4316 100644 --- a/harbour/contrib/hbqt/qtgui/QStandardItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QStandardItem.cpp @@ -101,40 +101,48 @@ QT_G_FUNC( release_QStandardItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStandardItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStandardItem * ) ph )->~QStandardItem(); - ph = NULL; + ( ( QStandardItem * ) p->ph )->~QStandardItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStandardItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStandardItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStandardItem" ); + #endif } } +void * gcAllocate_QStandardItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStandardItem; + #if defined(__debug__) + just_debug( " new_QStandardItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTANDARDITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStandardItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStandardItem* ) new QStandardItem() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStandardItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStandardItem( pObj ) ); } /* * QString accessibleDescription () const @@ -165,7 +173,7 @@ HB_FUNC( QT_QSTANDARDITEM_APPENDROW ) */ HB_FUNC( QT_QSTANDARDITEM_BACKGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QStandardItem( 1 )->background() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QStandardItem( 1 )->background() ) ) ); } /* @@ -213,7 +221,7 @@ HB_FUNC( QT_QSTANDARDITEM_COLUMNCOUNT ) */ HB_FUNC( QT_QSTANDARDITEM_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QStandardItem( 1 )->data( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::UserRole + 1 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QStandardItem( 1 )->data( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::UserRole + 1 ) ) ) ) ); } /* @@ -229,7 +237,7 @@ HB_FUNC( QT_QSTANDARDITEM_FLAGS ) */ HB_FUNC( QT_QSTANDARDITEM_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QStandardItem( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QStandardItem( 1 )->font() ) ) ); } /* @@ -237,7 +245,7 @@ HB_FUNC( QT_QSTANDARDITEM_FONT ) */ HB_FUNC( QT_QSTANDARDITEM_FOREGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QStandardItem( 1 )->foreground() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QStandardItem( 1 )->foreground() ) ) ); } /* @@ -253,7 +261,7 @@ HB_FUNC( QT_QSTANDARDITEM_HASCHILDREN ) */ HB_FUNC( QT_QSTANDARDITEM_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStandardItem( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStandardItem( 1 )->icon() ) ) ); } /* @@ -261,7 +269,7 @@ HB_FUNC( QT_QSTANDARDITEM_ICON ) */ HB_FUNC( QT_QSTANDARDITEM_INDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QStandardItem( 1 )->index() ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QStandardItem( 1 )->index() ) ) ); } /* @@ -629,7 +637,7 @@ HB_FUNC( QT_QSTANDARDITEM_SETWHATSTHIS ) */ HB_FUNC( QT_QSTANDARDITEM_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStandardItem( 1 )->sizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStandardItem( 1 )->sizeHint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStandardItemModel.cpp b/harbour/contrib/hbqt/qtgui/QStandardItemModel.cpp index 3f1508c536..2c81f00818 100644 --- a/harbour/contrib/hbqt/qtgui/QStandardItemModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QStandardItemModel.cpp @@ -92,52 +92,69 @@ * ~QStandardItemModel () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QStandardItemModel > pq; +} QGC_POINTER_QStandardItemModel; + QT_G_FUNC( release_QStandardItemModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStandardItemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QStandardItemModel * p = ( QGC_POINTER_QStandardItemModel * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItemModel p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItemModel ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QStandardItemModel * ) ph )->~QStandardItemModel(); - ph = NULL; + ( ( QStandardItemModel * ) p->ph )->~QStandardItemModel(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItemModel Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStandardItemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QStandardItemModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItemModel Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QStandardItemModel" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStandardItemModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStandardItemModel Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStandardItemModel" ); + #endif } } +void * gcAllocate_QStandardItemModel( void * pObj ) +{ + QGC_POINTER_QStandardItemModel * p = ( QGC_POINTER_QStandardItemModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QStandardItemModel ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStandardItemModel; + new( & p->pq ) QPointer< QStandardItemModel >( ( QStandardItemModel * ) pObj ); + #if defined(__debug__) + just_debug( " new_QStandardItemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTANDARDITEMMODEL ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QStandardItemModel > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStandardItemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QStandardItemModel* ) new QStandardItemModel( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStandardItemModel; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStandardItemModel( pObj ) ); } /* * void appendRow ( QStandardItem * item ) @@ -168,7 +185,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_HORIZONTALHEADERITEM ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_INDEXFROMITEM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QStandardItemModel( 1 )->indexFromItem( hbqt_par_QStandardItem( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QStandardItemModel( 1 )->indexFromItem( hbqt_par_QStandardItem( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStatusBar.cpp b/harbour/contrib/hbqt/qtgui/QStatusBar.cpp index cf9c62fb20..7603310208 100644 --- a/harbour/contrib/hbqt/qtgui/QStatusBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QStatusBar.cpp @@ -76,52 +76,69 @@ * virtual ~QStatusBar () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QStatusBar > pq; +} QGC_POINTER_QStatusBar; + QT_G_FUNC( release_QStatusBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStatusBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QStatusBar * p = ( QGC_POINTER_QStatusBar * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStatusBar p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QStatusBar ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QStatusBar * ) ph )->~QStatusBar(); - ph = NULL; + ( ( QStatusBar * ) p->ph )->~QStatusBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStatusBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStatusBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QStatusBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStatusBar Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QStatusBar" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStatusBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStatusBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStatusBar" ); + #endif } } +void * gcAllocate_QStatusBar( void * pObj ) +{ + QGC_POINTER_QStatusBar * p = ( QGC_POINTER_QStatusBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QStatusBar ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStatusBar; + new( & p->pq ) QPointer< QStatusBar >( ( QStatusBar * ) pObj ); + #if defined(__debug__) + just_debug( " new_QStatusBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTATUSBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QStatusBar > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStatusBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QStatusBar* ) new QStatusBar( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStatusBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStatusBar( pObj ) ); } /* * void addPermanentWidget ( QWidget * widget, int stretch = 0 ) diff --git a/harbour/contrib/hbqt/qtgui/QStringListModel.cpp b/harbour/contrib/hbqt/qtgui/QStringListModel.cpp index f8512e5091..af52998b11 100644 --- a/harbour/contrib/hbqt/qtgui/QStringListModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QStringListModel.cpp @@ -76,59 +76,76 @@ * QStringListModel ( const QStringList & strings, QObject * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QStringListModel > pq; +} QGC_POINTER_QStringListModel; + QT_G_FUNC( release_QStringListModel ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStringListModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QStringListModel * p = ( QGC_POINTER_QStringListModel * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStringListModel p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QStringListModel ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QStringListModel * ) ph )->~QStringListModel(); - ph = NULL; + ( ( QStringListModel * ) p->ph )->~QStringListModel(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStringListModel Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStringListModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QStringListModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStringListModel Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QStringListModel" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStringListModel" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStringListModel Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStringListModel" ); + #endif } } +void * gcAllocate_QStringListModel( void * pObj ) +{ + QGC_POINTER_QStringListModel * p = ( QGC_POINTER_QStringListModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QStringListModel ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStringListModel; + new( & p->pq ) QPointer< QStringListModel >( ( QStringListModel * ) pObj ); + #if defined(__debug__) + just_debug( " new_QStringListModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTRINGLISTMODEL ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QStringListModel > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStringListModel %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QStringListModel* ) new QStringListModel() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStringListModel; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStringListModel( pObj ) ); } /* * virtual QVariant data ( const QModelIndex & index, int role ) const */ HB_FUNC( QT_QSTRINGLISTMODEL_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QStringListModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), hb_parni( 3 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QStringListModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -184,7 +201,7 @@ HB_FUNC( QT_QSTRINGLISTMODEL_SETSTRINGLIST ) */ HB_FUNC( QT_QSTRINGLISTMODEL_STRINGLIST ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QStringListModel( 1 )->stringList() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QStringListModel( 1 )->stringList() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyle.cpp b/harbour/contrib/hbqt/qtgui/QStyle.cpp index b6aa3bf30e..4b7c9d8e3e 100644 --- a/harbour/contrib/hbqt/qtgui/QStyle.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyle.cpp @@ -93,31 +93,7 @@ QT_G_FUNC( release_QStyle ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QStyle * ) ph )->~QStyle(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QStyle" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyle" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QSTYLE ) @@ -176,7 +152,7 @@ HB_FUNC( QT_QSTYLE_DRAWPRIMITIVE ) */ HB_FUNC( QT_QSTYLE_GENERATEDICONPIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QStyle( 1 )->generatedIconPixmap( ( QIcon::Mode ) hb_parni( 2 ), *hbqt_par_QPixmap( 3 ), hbqt_par_QStyleOption( 4 ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QStyle( 1 )->generatedIconPixmap( ( QIcon::Mode ) hb_parni( 2 ), *hbqt_par_QPixmap( 3 ), hbqt_par_QStyleOption( 4 ) ) ) ) ); } /* @@ -192,7 +168,7 @@ HB_FUNC( QT_QSTYLE_HITTESTCOMPLEXCONTROL ) */ HB_FUNC( QT_QSTYLE_ITEMPIXMAPRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyle( 1 )->itemPixmapRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), *hbqt_par_QPixmap( 4 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->itemPixmapRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), *hbqt_par_QPixmap( 4 ) ) ) ) ); } /* @@ -200,7 +176,7 @@ HB_FUNC( QT_QSTYLE_ITEMPIXMAPRECT ) */ HB_FUNC( QT_QSTYLE_ITEMTEXTRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyle( 1 )->itemTextRect( *hbqt_par_QFontMetrics( 2 ), *hbqt_par_QRect( 3 ), hb_parni( 4 ), hb_parl( 5 ), hbqt_par_QString( 6 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->itemTextRect( *hbqt_par_QFontMetrics( 2 ), *hbqt_par_QRect( 3 ), hb_parni( 4 ), hb_parl( 5 ), hbqt_par_QString( 6 ) ) ) ) ); } /* @@ -248,7 +224,7 @@ HB_FUNC( QT_QSTYLE_POLISH_2 ) */ HB_FUNC( QT_QSTYLE_SIZEFROMCONTENTS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyle( 1 )->sizeFromContents( ( QStyle::ContentsType ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), *hbqt_par_QSize( 4 ), hbqt_par_QWidget( 5 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyle( 1 )->sizeFromContents( ( QStyle::ContentsType ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), *hbqt_par_QSize( 4 ), hbqt_par_QWidget( 5 ) ) ) ) ); } /* @@ -256,7 +232,7 @@ HB_FUNC( QT_QSTYLE_SIZEFROMCONTENTS ) */ HB_FUNC( QT_QSTYLE_STANDARDICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyle( 1 )->standardIcon( ( QStyle::StandardPixmap ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), hbqt_par_QWidget( 4 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyle( 1 )->standardIcon( ( QStyle::StandardPixmap ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), hbqt_par_QWidget( 4 ) ) ) ) ); } /* @@ -264,7 +240,7 @@ HB_FUNC( QT_QSTYLE_STANDARDICON ) */ HB_FUNC( QT_QSTYLE_STANDARDPALETTE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPalette( hbqt_par_QStyle( 1 )->standardPalette() ), release_QPalette ) ); + hb_retptrGC( gcAllocate_QPalette( new QPalette( hbqt_par_QStyle( 1 )->standardPalette() ) ) ); } /* @@ -280,7 +256,7 @@ HB_FUNC( QT_QSTYLE_STYLEHINT ) */ HB_FUNC( QT_QSTYLE_SUBCONTROLRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyle( 1 )->subControlRect( ( QStyle::ComplexControl ) hb_parni( 2 ), hbqt_par_QStyleOptionComplex( 3 ), ( QStyle::SubControl ) hb_parni( 4 ), hbqt_par_QWidget( 5 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->subControlRect( ( QStyle::ComplexControl ) hb_parni( 2 ), hbqt_par_QStyleOptionComplex( 3 ), ( QStyle::SubControl ) hb_parni( 4 ), hbqt_par_QWidget( 5 ) ) ) ) ); } /* @@ -288,7 +264,7 @@ HB_FUNC( QT_QSTYLE_SUBCONTROLRECT ) */ HB_FUNC( QT_QSTYLE_SUBELEMENTRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyle( 1 )->subElementRect( ( QStyle::SubElement ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), hbqt_par_QWidget( 4 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->subElementRect( ( QStyle::SubElement ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), hbqt_par_QWidget( 4 ) ) ) ) ); } /* @@ -312,7 +288,7 @@ HB_FUNC( QT_QSTYLE_UNPOLISH_1 ) */ HB_FUNC( QT_QSTYLE_ALIGNEDRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyle( 1 )->alignedRect( ( Qt::LayoutDirection ) hb_parni( 2 ), ( Qt::Alignment ) hb_parni( 3 ), *hbqt_par_QSize( 4 ), *hbqt_par_QRect( 5 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->alignedRect( ( Qt::LayoutDirection ) hb_parni( 2 ), ( Qt::Alignment ) hb_parni( 3 ), *hbqt_par_QSize( 4 ), *hbqt_par_QRect( 5 ) ) ) ) ); } /* @@ -344,7 +320,7 @@ HB_FUNC( QT_QSTYLE_VISUALALIGNMENT ) */ HB_FUNC( QT_QSTYLE_VISUALPOS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QStyle( 1 )->visualPos( ( Qt::LayoutDirection ) hb_parni( 2 ), *hbqt_par_QRect( 3 ), *hbqt_par_QPoint( 4 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QStyle( 1 )->visualPos( ( Qt::LayoutDirection ) hb_parni( 2 ), *hbqt_par_QRect( 3 ), *hbqt_par_QPoint( 4 ) ) ) ) ); } /* @@ -352,7 +328,7 @@ HB_FUNC( QT_QSTYLE_VISUALPOS ) */ HB_FUNC( QT_QSTYLE_VISUALRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyle( 1 )->visualRect( ( Qt::LayoutDirection ) hb_parni( 2 ), *hbqt_par_QRect( 3 ), *hbqt_par_QRect( 4 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->visualRect( ( Qt::LayoutDirection ) hb_parni( 2 ), *hbqt_par_QRect( 3 ), *hbqt_par_QRect( 4 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleFactory.cpp b/harbour/contrib/hbqt/qtgui/QStyleFactory.cpp index 201683b3c7..1bd5b4d386 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleFactory.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleFactory.cpp @@ -77,40 +77,48 @@ QT_G_FUNC( release_QStyleFactory ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleFactory %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleFactory p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleFactory ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleFactory * ) ph )->~QStyleFactory(); - ph = NULL; + ( ( QStyleFactory * ) p->ph )->~QStyleFactory(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleFactory Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleFactory %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleFactory" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleFactory Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleFactory" ); + #endif } } +void * gcAllocate_QStyleFactory( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleFactory; + #if defined(__debug__) + just_debug( " new_QStyleFactory %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEFACTORY ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleFactory %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QStyleFactory() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleFactory; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleFactory( pObj ) ); } /* * QStyle * create ( const QString & key ) @@ -125,7 +133,7 @@ HB_FUNC( QT_QSTYLEFACTORY_CREATE ) */ HB_FUNC( QT_QSTYLEFACTORY_KEYS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QStyleFactory( 1 )->keys() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QStyleFactory( 1 )->keys() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleHintReturn.cpp b/harbour/contrib/hbqt/qtgui/QStyleHintReturn.cpp index 7f3e79faec..4dddf2b314 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleHintReturn.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleHintReturn.cpp @@ -83,31 +83,7 @@ QT_G_FUNC( release_QStyleHintReturn ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleHintReturn %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QStyleHintReturn * ) ph )->~QStyleHintReturn(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QStyleHintReturn" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleHintReturn" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QSTYLEHINTRETURN ) diff --git a/harbour/contrib/hbqt/qtgui/QStyleHintReturnMask.cpp b/harbour/contrib/hbqt/qtgui/QStyleHintReturnMask.cpp index 6cb858e5a1..1479574770 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleHintReturnMask.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleHintReturnMask.cpp @@ -83,31 +83,7 @@ QT_G_FUNC( release_QStyleHintReturnMask ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleHintReturnMask %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QStyleHintReturnMask * ) ph )->~QStyleHintReturnMask(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QStyleHintReturnMask" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleHintReturnMask" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QSTYLEHINTRETURNMASK ) diff --git a/harbour/contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp b/harbour/contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp index f31eb1eae8..2d791b1d73 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp @@ -83,31 +83,7 @@ QT_G_FUNC( release_QStyleHintReturnVariant ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleHintReturnVariant %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QStyleHintReturnVariant * ) ph )->~QStyleHintReturnVariant(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QStyleHintReturnVariant" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleHintReturnVariant" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QSTYLEHINTRETURNVARIANT ) diff --git a/harbour/contrib/hbqt/qtgui/QStyleOption.cpp b/harbour/contrib/hbqt/qtgui/QStyleOption.cpp index 9395d164e2..72c20842b9 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOption.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOption.cpp @@ -85,40 +85,48 @@ QT_G_FUNC( release_QStyleOption ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOption %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOption p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOption ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOption * ) ph )->~QStyleOption(); - ph = NULL; + ( ( QStyleOption * ) p->ph )->~QStyleOption(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOption Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOption %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOption" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOption Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOption" ); + #endif } } +void * gcAllocate_QStyleOption( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOption; + #if defined(__debug__) + just_debug( " new_QStyleOption %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTION ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOption %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOption* ) new QStyleOption() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOption; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOption( pObj ) ); } /* * void initFrom ( const QWidget * widget ) @@ -141,7 +149,7 @@ HB_FUNC( QT_QSTYLEOPTION_DIRECTION ) */ HB_FUNC( QT_QSTYLEOPTION_FONTMETRICS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFontMetrics( hbqt_par_QStyleOption( 1 )->fontMetrics ), release_QFontMetrics ) ); + hb_retptrGC( gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QStyleOption( 1 )->fontMetrics ) ) ); } /* @@ -149,7 +157,7 @@ HB_FUNC( QT_QSTYLEOPTION_FONTMETRICS ) */ HB_FUNC( QT_QSTYLEOPTION_PALETTE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPalette( hbqt_par_QStyleOption( 1 )->palette ), release_QPalette ) ); + hb_retptrGC( gcAllocate_QPalette( new QPalette( hbqt_par_QStyleOption( 1 )->palette ) ) ); } /* @@ -157,7 +165,7 @@ HB_FUNC( QT_QSTYLEOPTION_PALETTE ) */ HB_FUNC( QT_QSTYLEOPTION_RECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyleOption( 1 )->rect ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyleOption( 1 )->rect ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionButton.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionButton.cpp index f7c597b80a..40be7d75d9 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionButton.cpp @@ -85,40 +85,48 @@ QT_G_FUNC( release_QStyleOptionButton ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionButton p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionButton ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionButton * ) ph )->~QStyleOptionButton(); - ph = NULL; + ( ( QStyleOptionButton * ) p->ph )->~QStyleOptionButton(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionButton Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionButton Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionButton" ); + #endif } } +void * gcAllocate_QStyleOptionButton( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionButton; + #if defined(__debug__) + just_debug( " new_QStyleOptionButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONBUTTON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionButton* ) new QStyleOptionButton() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionButton; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionButton( pObj ) ); } /* * ButtonFeatures features @@ -133,7 +141,7 @@ HB_FUNC( QT_QSTYLEOPTIONBUTTON_FEATURES ) */ HB_FUNC( QT_QSTYLEOPTIONBUTTON_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyleOptionButton( 1 )->icon ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionButton( 1 )->icon ) ) ); } /* @@ -141,7 +149,7 @@ HB_FUNC( QT_QSTYLEOPTIONBUTTON_ICON ) */ HB_FUNC( QT_QSTYLEOPTIONBUTTON_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyleOptionButton( 1 )->iconSize ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionButton( 1 )->iconSize ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionComboBox.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionComboBox.cpp index 7e6305b384..1f2f219c68 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionComboBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionComboBox.cpp @@ -83,47 +83,55 @@ QT_G_FUNC( release_QStyleOptionComboBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionComboBox p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionComboBox ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionComboBox * ) ph )->~QStyleOptionComboBox(); - ph = NULL; + ( ( QStyleOptionComboBox * ) p->ph )->~QStyleOptionComboBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionComboBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionComboBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionComboBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionComboBox" ); + #endif } } +void * gcAllocate_QStyleOptionComboBox( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionComboBox; + #if defined(__debug__) + just_debug( " new_QStyleOptionComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionComboBox* ) new QStyleOptionComboBox() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionComboBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionComboBox( pObj ) ); } /* * QIcon currentIcon */ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_CURRENTICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyleOptionComboBox( 1 )->currentIcon ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionComboBox( 1 )->currentIcon ) ) ); } /* @@ -155,7 +163,7 @@ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_FRAME ) */ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyleOptionComboBox( 1 )->iconSize ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionComboBox( 1 )->iconSize ) ) ); } /* @@ -163,7 +171,7 @@ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_ICONSIZE ) */ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_POPUPRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyleOptionComboBox( 1 )->popupRect ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionComboBox( 1 )->popupRect ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionComplex.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionComplex.cpp index 6d2f3b9e42..695eb48b2d 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionComplex.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionComplex.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QStyleOptionComplex ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionComplex %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionComplex p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionComplex ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionComplex * ) ph )->~QStyleOptionComplex(); - ph = NULL; + ( ( QStyleOptionComplex * ) p->ph )->~QStyleOptionComplex(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionComplex Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionComplex %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionComplex" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionComplex Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionComplex" ); + #endif } } +void * gcAllocate_QStyleOptionComplex( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionComplex; + #if defined(__debug__) + just_debug( " new_QStyleOptionComplex %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONCOMPLEX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionComplex %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionComplex* ) new QStyleOptionComplex() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionComplex; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionComplex( pObj ) ); } /* * QStyle::SubControls activeSubControls diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp index 3e6924f299..f06e370c42 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QStyleOptionDockWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionDockWidget p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionDockWidget ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionDockWidget * ) ph )->~QStyleOptionDockWidget(); - ph = NULL; + ( ( QStyleOptionDockWidget * ) p->ph )->~QStyleOptionDockWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionDockWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionDockWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionDockWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionDockWidget" ); + #endif } } +void * gcAllocate_QStyleOptionDockWidget( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionDockWidget; + #if defined(__debug__) + just_debug( " new_QStyleOptionDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONDOCKWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionDockWidget* ) new QStyleOptionDockWidget() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionDockWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionDockWidget( pObj ) ); } /* * bool closable diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp index 2b890d3f7f..d16dfb2e5f 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp @@ -83,47 +83,55 @@ QT_G_FUNC( release_QStyleOptionFocusRect ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionFocusRect %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionFocusRect p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionFocusRect ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionFocusRect * ) ph )->~QStyleOptionFocusRect(); - ph = NULL; + ( ( QStyleOptionFocusRect * ) p->ph )->~QStyleOptionFocusRect(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionFocusRect Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionFocusRect %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionFocusRect" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionFocusRect Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionFocusRect" ); + #endif } } +void * gcAllocate_QStyleOptionFocusRect( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionFocusRect; + #if defined(__debug__) + just_debug( " new_QStyleOptionFocusRect %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONFOCUSRECT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionFocusRect %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionFocusRect* ) new QStyleOptionFocusRect() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionFocusRect; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionFocusRect( pObj ) ); } /* * QColor backgroundColor */ HB_FUNC( QT_QSTYLEOPTIONFOCUSRECT_BACKGROUNDCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QStyleOptionFocusRect( 1 )->backgroundColor ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QStyleOptionFocusRect( 1 )->backgroundColor ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionFrame.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionFrame.cpp index d18a29f65d..6f319959b5 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionFrame.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QStyleOptionFrame ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionFrame p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionFrame ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionFrame * ) ph )->~QStyleOptionFrame(); - ph = NULL; + ( ( QStyleOptionFrame * ) p->ph )->~QStyleOptionFrame(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionFrame Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionFrame" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionFrame Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionFrame" ); + #endif } } +void * gcAllocate_QStyleOptionFrame( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionFrame; + #if defined(__debug__) + just_debug( " new_QStyleOptionFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONFRAME ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionFrame* ) new QStyleOptionFrame() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionFrame; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionFrame( pObj ) ); } /* * int lineWidth diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp index 710ff5c92f..37fb85a21c 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QStyleOptionGroupBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionGroupBox p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionGroupBox ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionGroupBox * ) ph )->~QStyleOptionGroupBox(); - ph = NULL; + ( ( QStyleOptionGroupBox * ) p->ph )->~QStyleOptionGroupBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionGroupBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionGroupBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionGroupBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionGroupBox" ); + #endif } } +void * gcAllocate_QStyleOptionGroupBox( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionGroupBox; + #if defined(__debug__) + just_debug( " new_QStyleOptionGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONGROUPBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionGroupBox* ) new QStyleOptionGroupBox() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionGroupBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionGroupBox( pObj ) ); } /* * QStyleOptionFrameV2::FrameFeatures features @@ -163,7 +171,7 @@ HB_FUNC( QT_QSTYLEOPTIONGROUPBOX_TEXTALIGNMENT ) */ HB_FUNC( QT_QSTYLEOPTIONGROUPBOX_TEXTCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QStyleOptionGroupBox( 1 )->textColor ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QStyleOptionGroupBox( 1 )->textColor ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionHeader.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionHeader.cpp index dc8c8ed95d..e91d9ca052 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionHeader.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionHeader.cpp @@ -86,47 +86,55 @@ QT_G_FUNC( release_QStyleOptionHeader ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionHeader p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionHeader ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionHeader * ) ph )->~QStyleOptionHeader(); - ph = NULL; + ( ( QStyleOptionHeader * ) p->ph )->~QStyleOptionHeader(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionHeader Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionHeader" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionHeader Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionHeader" ); + #endif } } +void * gcAllocate_QStyleOptionHeader( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionHeader; + #if defined(__debug__) + just_debug( " new_QStyleOptionHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONHEADER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionHeader* ) new QStyleOptionHeader() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionHeader; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionHeader( pObj ) ); } /* * QIcon icon */ HB_FUNC( QT_QSTYLEOPTIONHEADER_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyleOptionHeader( 1 )->icon ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionHeader( 1 )->icon ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp index b126b95fd1..2c24c925d1 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp @@ -85,40 +85,48 @@ QT_G_FUNC( release_QStyleOptionMenuItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionMenuItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionMenuItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionMenuItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionMenuItem * ) ph )->~QStyleOptionMenuItem(); - ph = NULL; + ( ( QStyleOptionMenuItem * ) p->ph )->~QStyleOptionMenuItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionMenuItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionMenuItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionMenuItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionMenuItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionMenuItem" ); + #endif } } +void * gcAllocate_QStyleOptionMenuItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionMenuItem; + #if defined(__debug__) + just_debug( " new_QStyleOptionMenuItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONMENUITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionMenuItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionMenuItem* ) new QStyleOptionMenuItem() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionMenuItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionMenuItem( pObj ) ); } /* * CheckType checkType @@ -141,7 +149,7 @@ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_CHECKED ) */ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QStyleOptionMenuItem( 1 )->font ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionMenuItem( 1 )->font ) ) ); } /* @@ -149,7 +157,7 @@ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_FONT ) */ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyleOptionMenuItem( 1 )->icon ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionMenuItem( 1 )->icon ) ) ); } /* @@ -181,7 +189,7 @@ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_MENUITEMTYPE ) */ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_MENURECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyleOptionMenuItem( 1 )->menuRect ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionMenuItem( 1 )->menuRect ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp index 1c52b00456..e951595c67 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp @@ -84,40 +84,48 @@ QT_G_FUNC( release_QStyleOptionProgressBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionProgressBar p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionProgressBar ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionProgressBar * ) ph )->~QStyleOptionProgressBar(); - ph = NULL; + ( ( QStyleOptionProgressBar * ) p->ph )->~QStyleOptionProgressBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionProgressBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionProgressBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionProgressBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionProgressBar" ); + #endif } } +void * gcAllocate_QStyleOptionProgressBar( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionProgressBar; + #if defined(__debug__) + just_debug( " new_QStyleOptionProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONPROGRESSBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionProgressBar* ) new QStyleOptionProgressBar() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionProgressBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionProgressBar( pObj ) ); } /* * int maximum diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp index eb7c794d34..6fe4863a0c 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QStyleOptionSizeGrip ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSizeGrip p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSizeGrip ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionSizeGrip * ) ph )->~QStyleOptionSizeGrip(); - ph = NULL; + ( ( QStyleOptionSizeGrip * ) p->ph )->~QStyleOptionSizeGrip(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSizeGrip Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionSizeGrip" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSizeGrip Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionSizeGrip" ); + #endif } } +void * gcAllocate_QStyleOptionSizeGrip( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionSizeGrip; + #if defined(__debug__) + just_debug( " new_QStyleOptionSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONSIZEGRIP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionSizeGrip* ) new QStyleOptionSizeGrip() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionSizeGrip; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionSizeGrip( pObj ) ); } /* * Qt::Corner corner diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionSlider.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionSlider.cpp index 2d297f1883..cba9f3dc99 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionSlider.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionSlider.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QStyleOptionSlider ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSlider p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSlider ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionSlider * ) ph )->~QStyleOptionSlider(); - ph = NULL; + ( ( QStyleOptionSlider * ) p->ph )->~QStyleOptionSlider(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSlider Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionSlider" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSlider Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionSlider" ); + #endif } } +void * gcAllocate_QStyleOptionSlider( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionSlider; + #if defined(__debug__) + just_debug( " new_QStyleOptionSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONSLIDER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionSlider* ) new QStyleOptionSlider() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionSlider; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionSlider( pObj ) ); } /* * bool dialWrapping diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp index 93bf3e7949..a3bb7f55cb 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QStyleOptionSpinBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSpinBox p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSpinBox ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionSpinBox * ) ph )->~QStyleOptionSpinBox(); - ph = NULL; + ( ( QStyleOptionSpinBox * ) p->ph )->~QStyleOptionSpinBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSpinBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionSpinBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionSpinBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionSpinBox" ); + #endif } } +void * gcAllocate_QStyleOptionSpinBox( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionSpinBox; + #if defined(__debug__) + just_debug( " new_QStyleOptionSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONSPINBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionSpinBox* ) new QStyleOptionSpinBox() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionSpinBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionSpinBox( pObj ) ); } /* * QAbstractSpinBox::ButtonSymbols buttonSymbols diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionTab.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionTab.cpp index 90c531304c..7a40360626 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionTab.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionTab.cpp @@ -87,40 +87,48 @@ QT_G_FUNC( release_QStyleOptionTab ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionTab %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTab p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTab ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionTab * ) ph )->~QStyleOptionTab(); - ph = NULL; + ( ( QStyleOptionTab * ) p->ph )->~QStyleOptionTab(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTab Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionTab %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionTab" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTab Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionTab" ); + #endif } } +void * gcAllocate_QStyleOptionTab( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionTab; + #if defined(__debug__) + just_debug( " new_QStyleOptionTab %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONTAB ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionTab %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionTab* ) new QStyleOptionTab() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionTab; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionTab( pObj ) ); } /* * CornerWidgets cornerWidgets @@ -135,7 +143,7 @@ HB_FUNC( QT_QSTYLEOPTIONTAB_CORNERWIDGETS ) */ HB_FUNC( QT_QSTYLEOPTIONTAB_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyleOptionTab( 1 )->icon ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionTab( 1 )->icon ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp index 01eccf0cd7..eb9587fdb0 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp @@ -83,47 +83,55 @@ QT_G_FUNC( release_QStyleOptionTabBarBase ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionTabBarBase %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTabBarBase p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTabBarBase ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionTabBarBase * ) ph )->~QStyleOptionTabBarBase(); - ph = NULL; + ( ( QStyleOptionTabBarBase * ) p->ph )->~QStyleOptionTabBarBase(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTabBarBase Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionTabBarBase %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionTabBarBase" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTabBarBase Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionTabBarBase" ); + #endif } } +void * gcAllocate_QStyleOptionTabBarBase( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionTabBarBase; + #if defined(__debug__) + just_debug( " new_QStyleOptionTabBarBase %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONTABBARBASE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionTabBarBase %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionTabBarBase* ) new QStyleOptionTabBarBase() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionTabBarBase; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionTabBarBase( pObj ) ); } /* * QRect selectedTabRect */ HB_FUNC( QT_QSTYLEOPTIONTABBARBASE_SELECTEDTABRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyleOptionTabBarBase( 1 )->selectedTabRect ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionTabBarBase( 1 )->selectedTabRect ) ) ); } /* @@ -139,7 +147,7 @@ HB_FUNC( QT_QSTYLEOPTIONTABBARBASE_SHAPE ) */ HB_FUNC( QT_QSTYLEOPTIONTABBARBASE_TABBARRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QStyleOptionTabBarBase( 1 )->tabBarRect ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionTabBarBase( 1 )->tabBarRect ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp index f99a47a964..98b5f1dc84 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp @@ -83,47 +83,55 @@ QT_G_FUNC( release_QStyleOptionTabWidgetFrame ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionTabWidgetFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTabWidgetFrame p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTabWidgetFrame ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionTabWidgetFrame * ) ph )->~QStyleOptionTabWidgetFrame(); - ph = NULL; + ( ( QStyleOptionTabWidgetFrame * ) p->ph )->~QStyleOptionTabWidgetFrame(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTabWidgetFrame Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionTabWidgetFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionTabWidgetFrame" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTabWidgetFrame Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionTabWidgetFrame" ); + #endif } } +void * gcAllocate_QStyleOptionTabWidgetFrame( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionTabWidgetFrame; + #if defined(__debug__) + just_debug( " new_QStyleOptionTabWidgetFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionTabWidgetFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionTabWidgetFrame* ) new QStyleOptionTabWidgetFrame() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionTabWidgetFrame; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionTabWidgetFrame( pObj ) ); } /* * QSize leftCornerWidgetSize */ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_LEFTCORNERWIDGETSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->leftCornerWidgetSize ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->leftCornerWidgetSize ) ) ); } /* @@ -147,7 +155,7 @@ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_MIDLINEWIDTH ) */ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_RIGHTCORNERWIDGETSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->rightCornerWidgetSize ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->rightCornerWidgetSize ) ) ); } /* @@ -163,7 +171,7 @@ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_SHAPE ) */ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_TABBARSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->tabBarSize ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->tabBarSize ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp index 8d678ed3af..70ee735bce 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp @@ -83,47 +83,55 @@ QT_G_FUNC( release_QStyleOptionTitleBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionTitleBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTitleBar p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTitleBar ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionTitleBar * ) ph )->~QStyleOptionTitleBar(); - ph = NULL; + ( ( QStyleOptionTitleBar * ) p->ph )->~QStyleOptionTitleBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTitleBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionTitleBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionTitleBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionTitleBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionTitleBar" ); + #endif } } +void * gcAllocate_QStyleOptionTitleBar( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionTitleBar; + #if defined(__debug__) + just_debug( " new_QStyleOptionTitleBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONTITLEBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionTitleBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionTitleBar* ) new QStyleOptionTitleBar() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionTitleBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionTitleBar( pObj ) ); } /* * QIcon icon */ HB_FUNC( QT_QSTYLEOPTIONTITLEBAR_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyleOptionTitleBar( 1 )->icon ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionTitleBar( 1 )->icon ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionToolBar.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionToolBar.cpp index ac54531ed6..85e3fc79b0 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionToolBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionToolBar.cpp @@ -86,40 +86,48 @@ QT_G_FUNC( release_QStyleOptionToolBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolBar p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolBar ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionToolBar * ) ph )->~QStyleOptionToolBar(); - ph = NULL; + ( ( QStyleOptionToolBar * ) p->ph )->~QStyleOptionToolBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionToolBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionToolBar" ); + #endif } } +void * gcAllocate_QStyleOptionToolBar( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionToolBar; + #if defined(__debug__) + just_debug( " new_QStyleOptionToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONTOOLBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionToolBar* ) new QStyleOptionToolBar() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionToolBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionToolBar( pObj ) ); } /* * ToolBarFeatures features diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionToolBox.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionToolBox.cpp index c3556234a6..03efac5732 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionToolBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionToolBox.cpp @@ -83,47 +83,55 @@ QT_G_FUNC( release_QStyleOptionToolBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolBox p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolBox ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionToolBox * ) ph )->~QStyleOptionToolBox(); - ph = NULL; + ( ( QStyleOptionToolBox * ) p->ph )->~QStyleOptionToolBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionToolBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionToolBox" ); + #endif } } +void * gcAllocate_QStyleOptionToolBox( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionToolBox; + #if defined(__debug__) + just_debug( " new_QStyleOptionToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONTOOLBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionToolBox* ) new QStyleOptionToolBox() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionToolBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionToolBox( pObj ) ); } /* * QIcon icon */ HB_FUNC( QT_QSTYLEOPTIONTOOLBOX_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyleOptionToolBox( 1 )->icon ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionToolBox( 1 )->icon ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionToolButton.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionToolButton.cpp index 8e861e356c..210ae53cd2 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionToolButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionToolButton.cpp @@ -85,40 +85,48 @@ QT_G_FUNC( release_QStyleOptionToolButton ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolButton p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolButton ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionToolButton * ) ph )->~QStyleOptionToolButton(); - ph = NULL; + ( ( QStyleOptionToolButton * ) p->ph )->~QStyleOptionToolButton(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolButton Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionToolButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionToolButton Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionToolButton" ); + #endif } } +void * gcAllocate_QStyleOptionToolButton( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionToolButton; + #if defined(__debug__) + just_debug( " new_QStyleOptionToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionToolButton* ) new QStyleOptionToolButton() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionToolButton; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionToolButton( pObj ) ); } /* * Qt::ArrowType arrowType @@ -141,7 +149,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_FEATURES ) */ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QStyleOptionToolButton( 1 )->font ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionToolButton( 1 )->font ) ) ); } /* @@ -149,7 +157,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_FONT ) */ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QStyleOptionToolButton( 1 )->icon ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionToolButton( 1 )->icon ) ) ); } /* @@ -157,7 +165,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_ICON ) */ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyleOptionToolButton( 1 )->iconSize ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionToolButton( 1 )->iconSize ) ) ); } /* @@ -165,7 +173,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_ICONSIZE ) */ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QStyleOptionToolButton( 1 )->pos ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QStyleOptionToolButton( 1 )->pos ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionViewItem.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionViewItem.cpp index 61f24a6c73..41db435169 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionViewItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionViewItem.cpp @@ -84,40 +84,48 @@ QT_G_FUNC( release_QStyleOptionViewItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyleOptionViewItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionViewItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionViewItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStyleOptionViewItem * ) ph )->~QStyleOptionViewItem(); - ph = NULL; + ( ( QStyleOptionViewItem * ) p->ph )->~QStyleOptionViewItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionViewItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyleOptionViewItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyleOptionViewItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyleOptionViewItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyleOptionViewItem" ); + #endif } } +void * gcAllocate_QStyleOptionViewItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyleOptionViewItem; + #if defined(__debug__) + just_debug( " new_QStyleOptionViewItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEOPTIONVIEWITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyleOptionViewItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStyleOptionViewItem* ) new QStyleOptionViewItem() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyleOptionViewItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyleOptionViewItem( pObj ) ); } /* * Qt::Alignment decorationAlignment @@ -140,7 +148,7 @@ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM_DECORATIONPOSITION ) */ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM_DECORATIONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyleOptionViewItem( 1 )->decorationSize ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionViewItem( 1 )->decorationSize ) ) ); } /* @@ -156,7 +164,7 @@ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM_DISPLAYALIGNMENT ) */ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QStyleOptionViewItem( 1 )->font ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionViewItem( 1 )->font ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStylePainter.cpp b/harbour/contrib/hbqt/qtgui/QStylePainter.cpp index d5d73b6394..cacd4215a2 100644 --- a/harbour/contrib/hbqt/qtgui/QStylePainter.cpp +++ b/harbour/contrib/hbqt/qtgui/QStylePainter.cpp @@ -79,40 +79,48 @@ QT_G_FUNC( release_QStylePainter ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStylePainter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStylePainter p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QStylePainter ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QStylePainter * ) ph )->~QStylePainter(); - ph = NULL; + ( ( QStylePainter * ) p->ph )->~QStylePainter(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStylePainter Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStylePainter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStylePainter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStylePainter Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStylePainter" ); + #endif } } +void * gcAllocate_QStylePainter( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStylePainter; + #if defined(__debug__) + just_debug( " new_QStylePainter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEPAINTER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStylePainter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QStylePainter* ) new QStylePainter() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStylePainter; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStylePainter( pObj ) ); } /* * bool begin ( QWidget * widget ) diff --git a/harbour/contrib/hbqt/qtgui/QStyledItemDelegate.cpp b/harbour/contrib/hbqt/qtgui/QStyledItemDelegate.cpp index 9fbfe29e9c..13bf78d794 100644 --- a/harbour/contrib/hbqt/qtgui/QStyledItemDelegate.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyledItemDelegate.cpp @@ -76,52 +76,69 @@ * ~QStyledItemDelegate () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QStyledItemDelegate > pq; +} QGC_POINTER_QStyledItemDelegate; + QT_G_FUNC( release_QStyledItemDelegate ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QStyledItemDelegate %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QStyledItemDelegate * p = ( QGC_POINTER_QStyledItemDelegate * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QStyledItemDelegate p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QStyledItemDelegate ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QStyledItemDelegate * ) ph )->~QStyledItemDelegate(); - ph = NULL; + ( ( QStyledItemDelegate * ) p->ph )->~QStyledItemDelegate(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QStyledItemDelegate Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QStyledItemDelegate %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QStyledItemDelegate" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyledItemDelegate Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QStyledItemDelegate" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QStyledItemDelegate" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QStyledItemDelegate Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QStyledItemDelegate" ); + #endif } } +void * gcAllocate_QStyledItemDelegate( void * pObj ) +{ + QGC_POINTER_QStyledItemDelegate * p = ( QGC_POINTER_QStyledItemDelegate * ) hb_gcAllocate( sizeof( QGC_POINTER_QStyledItemDelegate ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QStyledItemDelegate; + new( & p->pq ) QPointer< QStyledItemDelegate >( ( QStyledItemDelegate * ) pObj ); + #if defined(__debug__) + just_debug( " new_QStyledItemDelegate %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSTYLEDITEMDELEGATE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QStyledItemDelegate > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QStyledItemDelegate %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QStyledItemDelegate* ) new QStyledItemDelegate( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QStyledItemDelegate; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QStyledItemDelegate( pObj ) ); } /* * virtual QWidget * createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const @@ -168,7 +185,7 @@ HB_FUNC( QT_QSTYLEDITEMDELEGATE_SETMODELDATA ) */ HB_FUNC( QT_QSTYLEDITEMDELEGATE_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QStyledItemDelegate( 1 )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QStyledItemDelegate( 1 )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QSystemTrayIcon.cpp b/harbour/contrib/hbqt/qtgui/QSystemTrayIcon.cpp index 8534ff65cd..4c3ee37111 100644 --- a/harbour/contrib/hbqt/qtgui/QSystemTrayIcon.cpp +++ b/harbour/contrib/hbqt/qtgui/QSystemTrayIcon.cpp @@ -82,52 +82,69 @@ * ~QSystemTrayIcon () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSystemTrayIcon > pq; +} QGC_POINTER_QSystemTrayIcon; + QT_G_FUNC( release_QSystemTrayIcon ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QSystemTrayIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QSystemTrayIcon * p = ( QGC_POINTER_QSystemTrayIcon * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QSystemTrayIcon p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QSystemTrayIcon ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QSystemTrayIcon * ) ph )->~QSystemTrayIcon(); - ph = NULL; + ( ( QSystemTrayIcon * ) p->ph )->~QSystemTrayIcon(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSystemTrayIcon Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QSystemTrayIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QSystemTrayIcon" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSystemTrayIcon Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QSystemTrayIcon" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QSystemTrayIcon" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QSystemTrayIcon Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QSystemTrayIcon" ); + #endif } } +void * gcAllocate_QSystemTrayIcon( void * pObj ) +{ + QGC_POINTER_QSystemTrayIcon * p = ( QGC_POINTER_QSystemTrayIcon * ) hb_gcAllocate( sizeof( QGC_POINTER_QSystemTrayIcon ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSystemTrayIcon; + new( & p->pq ) QPointer< QSystemTrayIcon >( ( QSystemTrayIcon * ) pObj ); + #if defined(__debug__) + just_debug( " new_QSystemTrayIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QSYSTEMTRAYICON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QSystemTrayIcon > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QSystemTrayIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QSystemTrayIcon* ) new QSystemTrayIcon( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QSystemTrayIcon; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QSystemTrayIcon( pObj ) ); } /* * QMenu * contextMenu () const @@ -142,7 +159,7 @@ HB_FUNC( QT_QSYSTEMTRAYICON_CONTEXTMENU ) */ HB_FUNC( QT_QSYSTEMTRAYICON_GEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QSystemTrayIcon( 1 )->geometry() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QSystemTrayIcon( 1 )->geometry() ) ) ); } /* @@ -150,7 +167,7 @@ HB_FUNC( QT_QSYSTEMTRAYICON_GEOMETRY ) */ HB_FUNC( QT_QSYSTEMTRAYICON_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QSystemTrayIcon( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QSystemTrayIcon( 1 )->icon() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTabBar.cpp b/harbour/contrib/hbqt/qtgui/QTabBar.cpp index 039bef6f07..0545a6a38e 100644 --- a/harbour/contrib/hbqt/qtgui/QTabBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QTabBar.cpp @@ -83,52 +83,69 @@ * ~QTabBar () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTabBar > pq; +} QGC_POINTER_QTabBar; + QT_G_FUNC( release_QTabBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTabBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTabBar * p = ( QGC_POINTER_QTabBar * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTabBar p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTabBar ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTabBar * ) ph )->~QTabBar(); - ph = NULL; + ( ( QTabBar * ) p->ph )->~QTabBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTabBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTabBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTabBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTabBar Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTabBar" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTabBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTabBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTabBar" ); + #endif } } +void * gcAllocate_QTabBar( void * pObj ) +{ + QGC_POINTER_QTabBar * p = ( QGC_POINTER_QTabBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QTabBar ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTabBar; + new( & p->pq ) QPointer< QTabBar >( ( QTabBar * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTabBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTABBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTabBar > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTabBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTabBar* ) new QTabBar( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTabBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTabBar( pObj ) ); } /* * int addTab ( const QString & text ) @@ -191,7 +208,7 @@ HB_FUNC( QT_QTABBAR_EXPANDING ) */ HB_FUNC( QT_QTABBAR_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QTabBar( 1 )->iconSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QTabBar( 1 )->iconSize() ) ) ); } /* @@ -407,7 +424,7 @@ HB_FUNC( QT_QTABBAR_TABBUTTON ) */ HB_FUNC( QT_QTABBAR_TABDATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QTabBar( 1 )->tabData( hb_parni( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QTabBar( 1 )->tabData( hb_parni( 2 ) ) ) ) ); } /* @@ -415,7 +432,7 @@ HB_FUNC( QT_QTABBAR_TABDATA ) */ HB_FUNC( QT_QTABBAR_TABICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QTabBar( 1 )->tabIcon( hb_parni( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QTabBar( 1 )->tabIcon( hb_parni( 2 ) ) ) ) ); } /* @@ -423,7 +440,7 @@ HB_FUNC( QT_QTABBAR_TABICON ) */ HB_FUNC( QT_QTABBAR_TABRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QTabBar( 1 )->tabRect( hb_parni( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QTabBar( 1 )->tabRect( hb_parni( 2 ) ) ) ) ); } /* @@ -439,7 +456,7 @@ HB_FUNC( QT_QTABBAR_TABTEXT ) */ HB_FUNC( QT_QTABBAR_TABTEXTCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QTabBar( 1 )->tabTextColor( hb_parni( 2 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QTabBar( 1 )->tabTextColor( hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTabWidget.cpp b/harbour/contrib/hbqt/qtgui/QTabWidget.cpp index c7ac07e969..4ef181addd 100644 --- a/harbour/contrib/hbqt/qtgui/QTabWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QTabWidget.cpp @@ -81,52 +81,69 @@ * ~QTabWidget () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTabWidget > pq; +} QGC_POINTER_QTabWidget; + QT_G_FUNC( release_QTabWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTabWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTabWidget * p = ( QGC_POINTER_QTabWidget * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTabWidget p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTabWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTabWidget * ) ph )->~QTabWidget(); - ph = NULL; + ( ( QTabWidget * ) p->ph )->~QTabWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTabWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTabWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTabWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTabWidget Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTabWidget" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTabWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTabWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTabWidget" ); + #endif } } +void * gcAllocate_QTabWidget( void * pObj ) +{ + QGC_POINTER_QTabWidget * p = ( QGC_POINTER_QTabWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QTabWidget ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTabWidget; + new( & p->pq ) QPointer< QTabWidget >( ( QTabWidget * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTabWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTABWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTabWidget > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTabWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTabWidget* ) new QTabWidget( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTabWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTabWidget( pObj ) ); } /* * int addTab ( QWidget * page, const QString & label ) @@ -205,7 +222,7 @@ HB_FUNC( QT_QTABWIDGET_ELIDEMODE ) */ HB_FUNC( QT_QTABWIDGET_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QTabWidget( 1 )->iconSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QTabWidget( 1 )->iconSize() ) ) ); } /* @@ -373,7 +390,7 @@ HB_FUNC( QT_QTABWIDGET_SETUSESSCROLLBUTTONS ) */ HB_FUNC( QT_QTABWIDGET_TABICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QTabWidget( 1 )->tabIcon( hb_parni( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QTabWidget( 1 )->tabIcon( hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTableView.cpp b/harbour/contrib/hbqt/qtgui/QTableView.cpp index 9a1513b3ea..e13c597bc7 100644 --- a/harbour/contrib/hbqt/qtgui/QTableView.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableView.cpp @@ -93,52 +93,69 @@ HB_FUNC( QT_HBTABLEVIEW_DESTROY ) } +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTableView > pq; +} QGC_POINTER_QTableView; + QT_G_FUNC( release_QTableView ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTableView * p = ( QGC_POINTER_QTableView * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTableView p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTableView ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTableView * ) ph )->~QTableView(); - ph = NULL; + ( ( QTableView * ) p->ph )->~QTableView(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTableView Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTableView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTableView Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTableView" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTableView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTableView Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTableView" ); + #endif } } +void * gcAllocate_QTableView( void * pObj ) +{ + QGC_POINTER_QTableView * p = ( QGC_POINTER_QTableView * ) hb_gcAllocate( sizeof( QGC_POINTER_QTableView ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTableView; + new( & p->pq ) QPointer< QTableView >( ( QTableView * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTABLEVIEW ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTableView > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTableView* ) new QTableView( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTableView; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTableView( pObj ) ); } /* * void clearSpans () @@ -201,7 +218,7 @@ HB_FUNC( QT_QTABLEVIEW_HORIZONTALHEADER ) */ HB_FUNC( QT_QTABLEVIEW_INDEXAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QTableView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTableView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTableWidget.cpp b/harbour/contrib/hbqt/qtgui/QTableWidget.cpp index 50c1e28f1d..e8db6411cd 100644 --- a/harbour/contrib/hbqt/qtgui/QTableWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableWidget.cpp @@ -88,55 +88,72 @@ * ~QTableWidget () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTableWidget > pq; +} QGC_POINTER_QTableWidget; + QT_G_FUNC( release_QTableWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTableWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTableWidget * p = ( QGC_POINTER_QTableWidget * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidget p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTableWidget * ) ph )->~QTableWidget(); - ph = NULL; + ( ( QTableWidget * ) p->ph )->~QTableWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTableWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTableWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidget Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTableWidget" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTableWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTableWidget" ); + #endif } } +void * gcAllocate_QTableWidget( void * pObj ) +{ + QGC_POINTER_QTableWidget * p = ( QGC_POINTER_QTableWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QTableWidget ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTableWidget; + new( & p->pq ) QPointer< QTableWidget >( ( QTableWidget * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTableWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTABLEWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTableWidget > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTableWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 2 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) ) pObj = ( QTableWidget* ) new QTableWidget( hb_parni( 1 ), hb_parni( 2 ), hbqt_par_QWidget( 3 ) ) ; else pObj = ( QTableWidget* ) new QTableWidget( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTableWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTableWidget( pObj ) ); } /* * QWidget * cellWidget ( int row, int column ) const @@ -439,7 +456,7 @@ HB_FUNC( QT_QTABLEWIDGET_VISUALCOLUMN ) */ HB_FUNC( QT_QTABLEWIDGET_VISUALITEMRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QTableWidget( 1 )->visualItemRect( hbqt_par_QTableWidgetItem( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QTableWidget( 1 )->visualItemRect( hbqt_par_QTableWidgetItem( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTableWidgetItem.cpp b/harbour/contrib/hbqt/qtgui/QTableWidgetItem.cpp index 4d78b07c54..305cf314f5 100644 --- a/harbour/contrib/hbqt/qtgui/QTableWidgetItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableWidgetItem.cpp @@ -85,30 +85,44 @@ QT_G_FUNC( release_QTableWidgetItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTableWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidgetItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidgetItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTableWidgetItem * ) ph )->~QTableWidgetItem(); - ph = NULL; + ( ( QTableWidgetItem * ) p->ph )->~QTableWidgetItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidgetItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTableWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTableWidgetItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidgetItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTableWidgetItem" ); + #endif } } +void * gcAllocate_QTableWidgetItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTableWidgetItem; + #if defined(__debug__) + just_debug( " new_QTableWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTABLEWIDGETITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTableWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 2 && HB_ISCHAR( 1 ) && HB_ISNUM( 2 ) ) { @@ -127,20 +141,14 @@ hb_snprintf( str, sizeof(str), " GC: new QTableWidgetItem %i B %i pObj = new QTableWidgetItem( 0 ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTableWidgetItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTableWidgetItem( pObj ) ); } /* * QBrush background () const */ HB_FUNC( QT_QTABLEWIDGETITEM_BACKGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QTableWidgetItem( 1 )->background() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QTableWidgetItem( 1 )->background() ) ) ); } /* @@ -172,7 +180,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_COLUMN ) */ HB_FUNC( QT_QTABLEWIDGETITEM_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QTableWidgetItem( 1 )->data( hb_parni( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QTableWidgetItem( 1 )->data( hb_parni( 2 ) ) ) ) ); } /* @@ -188,7 +196,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_FLAGS ) */ HB_FUNC( QT_QTABLEWIDGETITEM_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QTableWidgetItem( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QTableWidgetItem( 1 )->font() ) ) ); } /* @@ -196,7 +204,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_FONT ) */ HB_FUNC( QT_QTABLEWIDGETITEM_FOREGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QTableWidgetItem( 1 )->foreground() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QTableWidgetItem( 1 )->foreground() ) ) ); } /* @@ -204,7 +212,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_FOREGROUND ) */ HB_FUNC( QT_QTABLEWIDGETITEM_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QTableWidgetItem( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QTableWidgetItem( 1 )->icon() ) ) ); } /* @@ -348,7 +356,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_SETWHATSTHIS ) */ HB_FUNC( QT_QTABLEWIDGETITEM_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QTableWidgetItem( 1 )->sizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QTableWidgetItem( 1 )->sizeHint() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp b/harbour/contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp index 2a46a3e943..c694a61c3f 100644 --- a/harbour/contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp @@ -79,40 +79,48 @@ QT_G_FUNC( release_QTableWidgetSelectionRange ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTableWidgetSelectionRange %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidgetSelectionRange p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidgetSelectionRange ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTableWidgetSelectionRange * ) ph )->~QTableWidgetSelectionRange(); - ph = NULL; + ( ( QTableWidgetSelectionRange * ) p->ph )->~QTableWidgetSelectionRange(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidgetSelectionRange Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTableWidgetSelectionRange %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTableWidgetSelectionRange" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTableWidgetSelectionRange Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTableWidgetSelectionRange" ); + #endif } } +void * gcAllocate_QTableWidgetSelectionRange( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTableWidgetSelectionRange; + #if defined(__debug__) + just_debug( " new_QTableWidgetSelectionRange %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTABLEWIDGETSELECTIONRANGE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTableWidgetSelectionRange %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QTableWidgetSelectionRange() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTableWidgetSelectionRange; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTableWidgetSelectionRange( pObj ) ); } /* * int bottomRow () const diff --git a/harbour/contrib/hbqt/qtgui/QTextBlock.cpp b/harbour/contrib/hbqt/qtgui/QTextBlock.cpp index da8f186cec..d1a3e6aa95 100644 --- a/harbour/contrib/hbqt/qtgui/QTextBlock.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextBlock.cpp @@ -77,30 +77,44 @@ QT_G_FUNC( release_QTextBlock ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextBlock %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBlock p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBlock ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextBlock * ) ph )->~QTextBlock(); - ph = NULL; + ( ( QTextBlock * ) p->ph )->~QTextBlock(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBlock Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextBlock %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextBlock" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBlock Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextBlock" ); + #endif } } +void * gcAllocate_QTextBlock( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextBlock; + #if defined(__debug__) + just_debug( " new_QTextBlock %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTBLOCK ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextBlock %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -111,20 +125,14 @@ hb_snprintf( str, sizeof(str), " GC: new QTextBlock %i B %i pObj = new QTextBlock() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextBlock; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextBlock( pObj ) ); } /* * QTextBlockFormat blockFormat () const */ HB_FUNC( QT_QTEXTBLOCK_BLOCKFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlockFormat( hbqt_par_QTextBlock( 1 )->blockFormat() ), release_QTextBlockFormat ) ); + hb_retptrGC( gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextBlock( 1 )->blockFormat() ) ) ); } /* @@ -148,7 +156,7 @@ HB_FUNC( QT_QTEXTBLOCK_BLOCKNUMBER ) */ HB_FUNC( QT_QTEXTBLOCK_CHARFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QTextBlock( 1 )->charFormat() ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextBlock( 1 )->charFormat() ) ) ); } /* @@ -236,7 +244,7 @@ HB_FUNC( QT_QTEXTBLOCK_LINECOUNT ) */ HB_FUNC( QT_QTEXTBLOCK_NEXT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextBlock( 1 )->next() ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextBlock( 1 )->next() ) ) ); } /* @@ -252,7 +260,7 @@ HB_FUNC( QT_QTEXTBLOCK_POSITION ) */ HB_FUNC( QT_QTEXTBLOCK_PREVIOUS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextBlock( 1 )->previous() ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextBlock( 1 )->previous() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextBlockFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextBlockFormat.cpp index 0cbbbac760..0f01560cdc 100644 --- a/harbour/contrib/hbqt/qtgui/QTextBlockFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextBlockFormat.cpp @@ -96,30 +96,44 @@ QT_G_FUNC( release_QTextBlockFormat ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextBlockFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBlockFormat p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBlockFormat ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextBlockFormat * ) ph )->~QTextBlockFormat(); - ph = NULL; + ( ( QTextBlockFormat * ) p->ph )->~QTextBlockFormat(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBlockFormat Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextBlockFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextBlockFormat" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBlockFormat Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextBlockFormat" ); + #endif } } +void * gcAllocate_QTextBlockFormat( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextBlockFormat; + #if defined(__debug__) + just_debug( " new_QTextBlockFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTBLOCKFORMAT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextBlockFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -130,13 +144,7 @@ hb_snprintf( str, sizeof(str), " GC: new QTextBlockFormat %i B %i pObj = ( QTextBlockFormat* ) new QTextBlockFormat() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextBlockFormat; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextBlockFormat( pObj ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QTextBrowser.cpp b/harbour/contrib/hbqt/qtgui/QTextBrowser.cpp index 408ee6bf82..190ff282d6 100644 --- a/harbour/contrib/hbqt/qtgui/QTextBrowser.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextBrowser.cpp @@ -75,52 +75,69 @@ * QTextBrowser ( QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTextBrowser > pq; +} QGC_POINTER_QTextBrowser; + QT_G_FUNC( release_QTextBrowser ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextBrowser %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTextBrowser * p = ( QGC_POINTER_QTextBrowser * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBrowser p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBrowser ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTextBrowser * ) ph )->~QTextBrowser(); - ph = NULL; + ( ( QTextBrowser * ) p->ph )->~QTextBrowser(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBrowser Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextBrowser %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTextBrowser" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBrowser Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTextBrowser" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextBrowser" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextBrowser Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextBrowser" ); + #endif } } +void * gcAllocate_QTextBrowser( void * pObj ) +{ + QGC_POINTER_QTextBrowser * p = ( QGC_POINTER_QTextBrowser * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextBrowser ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextBrowser; + new( & p->pq ) QPointer< QTextBrowser >( ( QTextBrowser * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTextBrowser %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTBROWSER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTextBrowser > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextBrowser %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTextBrowser* ) new QTextBrowser( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextBrowser; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextBrowser( pObj ) ); } /* * int backwardHistoryCount () const @@ -159,7 +176,7 @@ HB_FUNC( QT_QTEXTBROWSER_HISTORYTITLE ) */ HB_FUNC( QT_QTEXTBROWSER_HISTORYURL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QTextBrowser( 1 )->historyUrl( hb_parni( 2 ) ) ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QTextBrowser( 1 )->historyUrl( hb_parni( 2 ) ) ) ) ); } /* @@ -183,7 +200,7 @@ HB_FUNC( QT_QTEXTBROWSER_ISFORWARDAVAILABLE ) */ HB_FUNC( QT_QTEXTBROWSER_LOADRESOURCE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QTextBrowser( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QTextBrowser( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ) ) ); } /* @@ -207,7 +224,7 @@ HB_FUNC( QT_QTEXTBROWSER_OPENLINKS ) */ HB_FUNC( QT_QTEXTBROWSER_SEARCHPATHS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QTextBrowser( 1 )->searchPaths() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QTextBrowser( 1 )->searchPaths() ) ) ); } /* @@ -239,7 +256,7 @@ HB_FUNC( QT_QTEXTBROWSER_SETSEARCHPATHS ) */ HB_FUNC( QT_QTEXTBROWSER_SOURCE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QTextBrowser( 1 )->source() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QTextBrowser( 1 )->source() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextCharFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextCharFormat.cpp index 5f786abc8f..befc99af66 100644 --- a/harbour/contrib/hbqt/qtgui/QTextCharFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextCharFormat.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QTextCharFormat ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextCharFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextCharFormat p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextCharFormat ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextCharFormat * ) ph )->~QTextCharFormat(); - ph = NULL; + ( ( QTextCharFormat * ) p->ph )->~QTextCharFormat(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextCharFormat Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextCharFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextCharFormat" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextCharFormat Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextCharFormat" ); + #endif } } +void * gcAllocate_QTextCharFormat( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextCharFormat; + #if defined(__debug__) + just_debug( " new_QTextCharFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTCHARFORMAT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextCharFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextCharFormat* ) new QTextCharFormat() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextCharFormat; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextCharFormat( pObj ) ); } /* * QString anchorHref () const @@ -131,7 +139,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT_ANCHORHREF ) */ HB_FUNC( QT_QTEXTCHARFORMAT_ANCHORNAMES ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QStringList( hbqt_par_QTextCharFormat( 1 )->anchorNames() ), release_QStringList ) ); + hb_retptrGC( gcAllocate_QStringList( new QStringList( hbqt_par_QTextCharFormat( 1 )->anchorNames() ) ) ); } /* @@ -139,7 +147,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT_ANCHORNAMES ) */ HB_FUNC( QT_QTEXTCHARFORMAT_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QTextCharFormat( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QTextCharFormat( 1 )->font() ) ) ); } /* @@ -459,7 +467,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT_SETVERTICALALIGNMENT ) */ HB_FUNC( QT_QTEXTCHARFORMAT_TEXTOUTLINE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPen( hbqt_par_QTextCharFormat( 1 )->textOutline() ), release_QPen ) ); + hb_retptrGC( gcAllocate_QPen( new QPen( hbqt_par_QTextCharFormat( 1 )->textOutline() ) ) ); } /* @@ -475,7 +483,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT_TOOLTIP ) */ HB_FUNC( QT_QTEXTCHARFORMAT_UNDERLINECOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QTextCharFormat( 1 )->underlineColor() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QTextCharFormat( 1 )->underlineColor() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextCursor.cpp b/harbour/contrib/hbqt/qtgui/QTextCursor.cpp index 6870ec8ab6..c6a6bbb113 100644 --- a/harbour/contrib/hbqt/qtgui/QTextCursor.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextCursor.cpp @@ -89,30 +89,44 @@ QT_G_FUNC( release_QTextCursor ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextCursor p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextCursor ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextCursor * ) ph )->~QTextCursor(); - ph = NULL; + ( ( QTextCursor * ) p->ph )->~QTextCursor(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextCursor Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextCursor" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextCursor Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextCursor" ); + #endif } } +void * gcAllocate_QTextCursor( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextCursor; + #if defined(__debug__) + just_debug( " new_QTextCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTCURSOR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { @@ -144,13 +158,7 @@ hb_snprintf( str, sizeof(str), " GC: new QTextCursor %i B %i pObj = ( QTextCursor* ) new QTextCursor() ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextCursor; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextCursor( pObj ) ); } /* * int anchor () const @@ -205,7 +213,7 @@ HB_FUNC( QT_QTEXTCURSOR_BEGINEDITBLOCK ) */ HB_FUNC( QT_QTEXTCURSOR_BLOCKCHARFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QTextCursor( 1 )->blockCharFormat() ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextCursor( 1 )->blockCharFormat() ) ) ); } /* @@ -213,7 +221,7 @@ HB_FUNC( QT_QTEXTCURSOR_BLOCKCHARFORMAT ) */ HB_FUNC( QT_QTEXTCURSOR_BLOCKFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlockFormat( hbqt_par_QTextCursor( 1 )->blockFormat() ), release_QTextBlockFormat ) ); + hb_retptrGC( gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextCursor( 1 )->blockFormat() ) ) ); } /* @@ -229,7 +237,7 @@ HB_FUNC( QT_QTEXTCURSOR_BLOCKNUMBER ) */ HB_FUNC( QT_QTEXTCURSOR_CHARFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QTextCursor( 1 )->charFormat() ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextCursor( 1 )->charFormat() ) ) ); } /* @@ -575,7 +583,7 @@ HB_FUNC( QT_QTEXTCURSOR_SELECTEDTEXT ) */ HB_FUNC( QT_QTEXTCURSOR_SELECTION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextDocumentFragment( hbqt_par_QTextCursor( 1 )->selection() ), release_QTextDocumentFragment ) ); + hb_retptrGC( gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextCursor( 1 )->selection() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextDocument.cpp b/harbour/contrib/hbqt/qtgui/QTextDocument.cpp index bc70e16aa1..eb6c5c4a93 100644 --- a/harbour/contrib/hbqt/qtgui/QTextDocument.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextDocument.cpp @@ -99,52 +99,69 @@ * ~QTextDocument () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTextDocument > pq; +} QGC_POINTER_QTextDocument; + QT_G_FUNC( release_QTextDocument ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextDocument %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTextDocument * p = ( QGC_POINTER_QTextDocument * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocument p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocument ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTextDocument * ) ph )->~QTextDocument(); - ph = NULL; + ( ( QTextDocument * ) p->ph )->~QTextDocument(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocument Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextDocument %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTextDocument" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocument Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTextDocument" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextDocument" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocument Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextDocument" ); + #endif } } +void * gcAllocate_QTextDocument( void * pObj ) +{ + QGC_POINTER_QTextDocument * p = ( QGC_POINTER_QTextDocument * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextDocument ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextDocument; + new( & p->pq ) QPointer< QTextDocument >( ( QTextDocument * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTextDocument %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTDOCUMENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTextDocument > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextDocument %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTextDocument* ) new QTextDocument( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextDocument; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextDocument( pObj ) ); } /* * void addResource ( int type, const QUrl & name, const QVariant & resource ) @@ -167,7 +184,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_ADJUSTSIZE ) */ HB_FUNC( QT_QTEXTDOCUMENT_BEGIN ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextDocument( 1 )->begin() ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->begin() ) ) ); } /* @@ -207,7 +224,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_CLONE ) */ HB_FUNC( QT_QTEXTDOCUMENT_DEFAULTFONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QTextDocument( 1 )->defaultFont() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QTextDocument( 1 )->defaultFont() ) ) ); } /* @@ -223,7 +240,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_DEFAULTSTYLESHEET ) */ HB_FUNC( QT_QTEXTDOCUMENT_DEFAULTTEXTOPTION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextOption( hbqt_par_QTextDocument( 1 )->defaultTextOption() ), release_QTextOption ) ); + hb_retptrGC( gcAllocate_QTextOption( new QTextOption( hbqt_par_QTextDocument( 1 )->defaultTextOption() ) ) ); } /* @@ -255,7 +272,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_DRAWCONTENTS ) */ HB_FUNC( QT_QTEXTDOCUMENT_END ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextDocument( 1 )->end() ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->end() ) ) ); } /* @@ -263,7 +280,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_END ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( hbqt_par_QString( 2 ), *hbqt_par_QTextCursor( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ), release_QTextCursor ) ); + hb_retptrGC( gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( hbqt_par_QString( 2 ), *hbqt_par_QTextCursor( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ) ) ); } /* @@ -271,7 +288,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FIND ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIND_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( *hbqt_par_QRegExp( 2 ), *hbqt_par_QTextCursor( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ), release_QTextCursor ) ); + hb_retptrGC( gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( *hbqt_par_QRegExp( 2 ), *hbqt_par_QTextCursor( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ) ) ); } /* @@ -279,7 +296,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FIND_1 ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIND_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( hbqt_par_QString( 2 ), hb_parni( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ), release_QTextCursor ) ); + hb_retptrGC( gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( hbqt_par_QString( 2 ), hb_parni( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ) ) ); } /* @@ -287,7 +304,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FIND_2 ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIND_3 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( *hbqt_par_QRegExp( 2 ), hb_parni( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ), release_QTextCursor ) ); + hb_retptrGC( gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( *hbqt_par_QRegExp( 2 ), hb_parni( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ) ) ); } /* @@ -295,7 +312,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FIND_3 ) */ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlock( hb_parni( 2 ) ) ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlock( hb_parni( 2 ) ) ) ) ); } /* @@ -303,7 +320,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCK ) */ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCKBYLINENUMBER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlockByLineNumber( hb_parni( 2 ) ) ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlockByLineNumber( hb_parni( 2 ) ) ) ) ); } /* @@ -311,7 +328,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCKBYLINENUMBER ) */ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCKBYNUMBER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlockByNumber( hb_parni( 2 ) ) ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlockByNumber( hb_parni( 2 ) ) ) ) ); } /* @@ -319,7 +336,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCKBYNUMBER ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIRSTBLOCK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextDocument( 1 )->firstBlock() ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->firstBlock() ) ) ); } /* @@ -383,7 +400,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_ISUNDOREDOENABLED ) */ HB_FUNC( QT_QTEXTDOCUMENT_LASTBLOCK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlock( hbqt_par_QTextDocument( 1 )->lastBlock() ), release_QTextBlock ) ); + hb_retptrGC( gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->lastBlock() ) ) ); } /* @@ -447,7 +464,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_PAGECOUNT ) */ HB_FUNC( QT_QTEXTDOCUMENT_PAGESIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QTextDocument( 1 )->pageSize() ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QTextDocument( 1 )->pageSize() ) ) ); } /* @@ -471,7 +488,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_REDO ) */ HB_FUNC( QT_QTEXTDOCUMENT_RESOURCE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QTextDocument( 1 )->resource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QTextDocument( 1 )->resource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ) ) ); } /* @@ -607,7 +624,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_SETUSEDESIGNMETRICS ) */ HB_FUNC( QT_QTEXTDOCUMENT_SIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizeF( hbqt_par_QTextDocument( 1 )->size() ), release_QSizeF ) ); + hb_retptrGC( gcAllocate_QSizeF( new QSizeF( hbqt_par_QTextDocument( 1 )->size() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextDocumentFragment.cpp b/harbour/contrib/hbqt/qtgui/QTextDocumentFragment.cpp index 9c7e276aaf..a0e0d4daf5 100644 --- a/harbour/contrib/hbqt/qtgui/QTextDocumentFragment.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextDocumentFragment.cpp @@ -81,40 +81,48 @@ QT_G_FUNC( release_QTextDocumentFragment ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextDocumentFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocumentFragment p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocumentFragment ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextDocumentFragment * ) ph )->~QTextDocumentFragment(); - ph = NULL; + ( ( QTextDocumentFragment * ) p->ph )->~QTextDocumentFragment(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocumentFragment Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextDocumentFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextDocumentFragment" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocumentFragment Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextDocumentFragment" ); + #endif } } +void * gcAllocate_QTextDocumentFragment( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextDocumentFragment; + #if defined(__debug__) + just_debug( " new_QTextDocumentFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextDocumentFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextDocumentFragment* ) new QTextDocumentFragment() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextDocumentFragment; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextDocumentFragment( pObj ) ); } /* * bool isEmpty () const @@ -153,7 +161,7 @@ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_TOPLAINTEXT ) */ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMHTML ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromHtml( hbqt_par_QString( 2 ) ) ), release_QTextDocumentFragment ) ); + hb_retptrGC( gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromHtml( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -161,7 +169,7 @@ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMHTML ) */ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMHTML_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromHtml( hbqt_par_QString( 2 ), hbqt_par_QTextDocument( 3 ) ) ), release_QTextDocumentFragment ) ); + hb_retptrGC( gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromHtml( hbqt_par_QString( 2 ), hbqt_par_QTextDocument( 3 ) ) ) ) ); } /* @@ -169,7 +177,7 @@ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMHTML_1 ) */ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMPLAINTEXT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromPlainText( hbqt_par_QString( 2 ) ) ), release_QTextDocumentFragment ) ); + hb_retptrGC( gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromPlainText( hbqt_par_QString( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QTextDocumentWriter.cpp b/harbour/contrib/hbqt/qtgui/QTextDocumentWriter.cpp index fa841f2c2f..fb0277ae95 100644 --- a/harbour/contrib/hbqt/qtgui/QTextDocumentWriter.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextDocumentWriter.cpp @@ -80,40 +80,48 @@ QT_G_FUNC( release_QTextDocumentWriter ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextDocumentWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocumentWriter p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocumentWriter ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextDocumentWriter * ) ph )->~QTextDocumentWriter(); - ph = NULL; + ( ( QTextDocumentWriter * ) p->ph )->~QTextDocumentWriter(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocumentWriter Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextDocumentWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextDocumentWriter" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextDocumentWriter Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextDocumentWriter" ); + #endif } } +void * gcAllocate_QTextDocumentWriter( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextDocumentWriter; + #if defined(__debug__) + just_debug( " new_QTextDocumentWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTDOCUMENTWRITER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextDocumentWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextDocumentWriter* ) new QTextDocumentWriter() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextDocumentWriter; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextDocumentWriter( pObj ) ); } /* * QTextCodec * codec () const @@ -144,7 +152,7 @@ HB_FUNC( QT_QTEXTDOCUMENTWRITER_FILENAME ) */ HB_FUNC( QT_QTEXTDOCUMENTWRITER_FORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QTextDocumentWriter( 1 )->format() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextDocumentWriter( 1 )->format() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextEdit.cpp b/harbour/contrib/hbqt/qtgui/QTextEdit.cpp index 0d0b71a6a0..4c6660b91f 100644 --- a/harbour/contrib/hbqt/qtgui/QTextEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextEdit.cpp @@ -94,55 +94,72 @@ */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTextEdit > pq; +} QGC_POINTER_QTextEdit; + QT_G_FUNC( release_QTextEdit ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTextEdit * p = ( QGC_POINTER_QTextEdit * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEdit p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTextEdit * ) ph )->~QTextEdit(); - ph = NULL; + ( ( QTextEdit * ) p->ph )->~QTextEdit(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEdit Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTextEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEdit Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTextEdit" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextEdit Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextEdit" ); + #endif } } +void * gcAllocate_QTextEdit( void * pObj ) +{ + QGC_POINTER_QTextEdit * p = ( QGC_POINTER_QTextEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextEdit ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextEdit; + new( & p->pq ) QPointer< QTextEdit >( ( QTextEdit * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTextEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTEDIT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTextEdit > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_pcount() >= 1 && HB_ISCHAR( 1 ) ) pObj = ( QTextEdit* ) new QTextEdit( hbqt_par_QString( 1 ), hbqt_par_QWidget( 2 ) ) ; else pObj = ( QTextEdit* ) new QTextEdit( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextEdit; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextEdit( pObj ) ); } /* * bool acceptRichText () const @@ -205,7 +222,7 @@ HB_FUNC( QT_QTEXTEDIT_CREATESTANDARDCONTEXTMENU_1 ) */ HB_FUNC( QT_QTEXTEDIT_CURRENTCHARFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QTextEdit( 1 )->currentCharFormat() ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextEdit( 1 )->currentCharFormat() ) ) ); } /* @@ -213,7 +230,7 @@ HB_FUNC( QT_QTEXTEDIT_CURRENTCHARFORMAT ) */ HB_FUNC( QT_QTEXTEDIT_CURRENTFONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QTextEdit( 1 )->currentFont() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QTextEdit( 1 )->currentFont() ) ) ); } /* @@ -221,7 +238,7 @@ HB_FUNC( QT_QTEXTEDIT_CURRENTFONT ) */ HB_FUNC( QT_QTEXTEDIT_CURSORFORPOSITION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCursor( hbqt_par_QTextEdit( 1 )->cursorForPosition( *hbqt_par_QPoint( 2 ) ) ), release_QTextCursor ) ); + hb_retptrGC( gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextEdit( 1 )->cursorForPosition( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -229,7 +246,7 @@ HB_FUNC( QT_QTEXTEDIT_CURSORFORPOSITION ) */ HB_FUNC( QT_QTEXTEDIT_CURSORRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QTextEdit( 1 )->cursorRect( *hbqt_par_QTextCursor( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QTextEdit( 1 )->cursorRect( *hbqt_par_QTextCursor( 2 ) ) ) ) ); } /* @@ -237,7 +254,7 @@ HB_FUNC( QT_QTEXTEDIT_CURSORRECT ) */ HB_FUNC( QT_QTEXTEDIT_CURSORRECT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QTextEdit( 1 )->cursorRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QTextEdit( 1 )->cursorRect() ) ) ); } /* @@ -357,7 +374,7 @@ HB_FUNC( QT_QTEXTEDIT_LINEWRAPMODE ) */ HB_FUNC( QT_QTEXTEDIT_LOADRESOURCE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QTextEdit( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QTextEdit( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ) ) ); } /* @@ -541,7 +558,7 @@ HB_FUNC( QT_QTEXTEDIT_TABSTOPWIDTH ) */ HB_FUNC( QT_QTEXTEDIT_TEXTBACKGROUNDCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QTextEdit( 1 )->textBackgroundColor() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QTextEdit( 1 )->textBackgroundColor() ) ) ); } /* @@ -549,7 +566,7 @@ HB_FUNC( QT_QTEXTEDIT_TEXTBACKGROUNDCOLOR ) */ HB_FUNC( QT_QTEXTEDIT_TEXTCOLOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QTextEdit( 1 )->textColor() ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QTextEdit( 1 )->textColor() ) ) ); } /* @@ -557,7 +574,7 @@ HB_FUNC( QT_QTEXTEDIT_TEXTCOLOR ) */ HB_FUNC( QT_QTEXTEDIT_TEXTCURSOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCursor( hbqt_par_QTextEdit( 1 )->textCursor() ), release_QTextCursor ) ); + hb_retptrGC( gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextEdit( 1 )->textCursor() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextFormat.cpp index 60c63077e4..9dc8a6e5c5 100644 --- a/harbour/contrib/hbqt/qtgui/QTextFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextFormat.cpp @@ -103,47 +103,55 @@ QT_G_FUNC( release_QTextFormat ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFormat p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFormat ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextFormat * ) ph )->~QTextFormat(); - ph = NULL; + ( ( QTextFormat * ) p->ph )->~QTextFormat(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFormat Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextFormat" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFormat Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextFormat" ); + #endif } } +void * gcAllocate_QTextFormat( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextFormat; + #if defined(__debug__) + just_debug( " new_QTextFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTFORMAT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextFormat* ) new QTextFormat() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextFormat; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextFormat( pObj ) ); } /* * QBrush background () const */ HB_FUNC( QT_QTEXTFORMAT_BACKGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QTextFormat( 1 )->background() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->background() ) ) ); } /* @@ -159,7 +167,7 @@ HB_FUNC( QT_QTEXTFORMAT_BOOLPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_BRUSHPROPERTY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QTextFormat( 1 )->brushProperty( hb_parni( 2 ) ) ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->brushProperty( hb_parni( 2 ) ) ) ) ); } /* @@ -191,7 +199,7 @@ HB_FUNC( QT_QTEXTFORMAT_CLEARPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_COLORPROPERTY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QColor( hbqt_par_QTextFormat( 1 )->colorProperty( hb_parni( 2 ) ) ), release_QColor ) ); + hb_retptrGC( gcAllocate_QColor( new QColor( hbqt_par_QTextFormat( 1 )->colorProperty( hb_parni( 2 ) ) ) ) ); } /* @@ -207,7 +215,7 @@ HB_FUNC( QT_QTEXTFORMAT_DOUBLEPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_FOREGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QTextFormat( 1 )->foreground() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->foreground() ) ) ); } /* @@ -303,7 +311,7 @@ HB_FUNC( QT_QTEXTFORMAT_LAYOUTDIRECTION ) */ HB_FUNC( QT_QTEXTFORMAT_LENGTHPROPERTY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextLength( hbqt_par_QTextFormat( 1 )->lengthProperty( hb_parni( 2 ) ) ), release_QTextLength ) ); + hb_retptrGC( gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFormat( 1 )->lengthProperty( hb_parni( 2 ) ) ) ) ); } /* @@ -335,7 +343,7 @@ HB_FUNC( QT_QTEXTFORMAT_OBJECTTYPE ) */ HB_FUNC( QT_QTEXTFORMAT_PENPROPERTY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPen( hbqt_par_QTextFormat( 1 )->penProperty( hb_parni( 2 ) ) ), release_QPen ) ); + hb_retptrGC( gcAllocate_QPen( new QPen( hbqt_par_QTextFormat( 1 )->penProperty( hb_parni( 2 ) ) ) ) ); } /* @@ -343,7 +351,7 @@ HB_FUNC( QT_QTEXTFORMAT_PENPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_PROPERTY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QTextFormat( 1 )->property( hb_parni( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QTextFormat( 1 )->property( hb_parni( 2 ) ) ) ) ); } /* @@ -415,7 +423,7 @@ HB_FUNC( QT_QTEXTFORMAT_STRINGPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_TOBLOCKFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextBlockFormat( hbqt_par_QTextFormat( 1 )->toBlockFormat() ), release_QTextBlockFormat ) ); + hb_retptrGC( gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextFormat( 1 )->toBlockFormat() ) ) ); } /* @@ -423,7 +431,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOBLOCKFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOCHARFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QTextFormat( 1 )->toCharFormat() ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextFormat( 1 )->toCharFormat() ) ) ); } /* @@ -431,7 +439,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOCHARFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOFRAMEFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextFrameFormat( hbqt_par_QTextFormat( 1 )->toFrameFormat() ), release_QTextFrameFormat ) ); + hb_retptrGC( gcAllocate_QTextFrameFormat( new QTextFrameFormat( hbqt_par_QTextFormat( 1 )->toFrameFormat() ) ) ); } /* @@ -439,7 +447,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOFRAMEFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOIMAGEFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextImageFormat( hbqt_par_QTextFormat( 1 )->toImageFormat() ), release_QTextImageFormat ) ); + hb_retptrGC( gcAllocate_QTextImageFormat( new QTextImageFormat( hbqt_par_QTextFormat( 1 )->toImageFormat() ) ) ); } /* @@ -447,7 +455,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOIMAGEFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOLISTFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextListFormat( hbqt_par_QTextFormat( 1 )->toListFormat() ), release_QTextListFormat ) ); + hb_retptrGC( gcAllocate_QTextListFormat( new QTextListFormat( hbqt_par_QTextFormat( 1 )->toListFormat() ) ) ); } /* @@ -455,7 +463,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOLISTFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOTABLEFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextTableFormat( hbqt_par_QTextFormat( 1 )->toTableFormat() ), release_QTextTableFormat ) ); + hb_retptrGC( gcAllocate_QTextTableFormat( new QTextTableFormat( hbqt_par_QTextFormat( 1 )->toTableFormat() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextFragment.cpp b/harbour/contrib/hbqt/qtgui/QTextFragment.cpp index 38cc5daff8..125b43222f 100644 --- a/harbour/contrib/hbqt/qtgui/QTextFragment.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextFragment.cpp @@ -78,47 +78,55 @@ QT_G_FUNC( release_QTextFragment ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFragment p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFragment ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextFragment * ) ph )->~QTextFragment(); - ph = NULL; + ( ( QTextFragment * ) p->ph )->~QTextFragment(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFragment Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextFragment" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFragment Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextFragment" ); + #endif } } +void * gcAllocate_QTextFragment( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextFragment; + #if defined(__debug__) + just_debug( " new_QTextFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTFRAGMENT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextFragment* ) new QTextFragment() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextFragment; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextFragment( pObj ) ); } /* * QTextCharFormat charFormat () const */ HB_FUNC( QT_QTEXTFRAGMENT_CHARFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCharFormat( hbqt_par_QTextFragment( 1 )->charFormat() ), release_QTextCharFormat ) ); + hb_retptrGC( gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextFragment( 1 )->charFormat() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextFrame.cpp b/harbour/contrib/hbqt/qtgui/QTextFrame.cpp index 4843703b82..de3e7e5714 100644 --- a/harbour/contrib/hbqt/qtgui/QTextFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextFrame.cpp @@ -91,59 +91,76 @@ * ~QTextFrame () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTextFrame > pq; +} QGC_POINTER_QTextFrame; + QT_G_FUNC( release_QTextFrame ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTextFrame * p = ( QGC_POINTER_QTextFrame * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrame p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrame ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTextFrame * ) ph )->~QTextFrame(); - ph = NULL; + ( ( QTextFrame * ) p->ph )->~QTextFrame(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrame Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTextFrame" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrame Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTextFrame" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextFrame" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrame Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextFrame" ); + #endif } } +void * gcAllocate_QTextFrame( void * pObj ) +{ + QGC_POINTER_QTextFrame * p = ( QGC_POINTER_QTextFrame * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextFrame ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextFrame; + new( & p->pq ) QPointer< QTextFrame >( ( QTextFrame * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTextFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTFRAME ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTextFrame > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTextFrame* ) new QTextFrame( hbqt_par_QTextDocument( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextFrame; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextFrame( pObj ) ); } /* * QTextCursor firstCursorPosition () const */ HB_FUNC( QT_QTEXTFRAME_FIRSTCURSORPOSITION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCursor( hbqt_par_QTextFrame( 1 )->firstCursorPosition() ), release_QTextCursor ) ); + hb_retptrGC( gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextFrame( 1 )->firstCursorPosition() ) ) ); } /* @@ -159,7 +176,7 @@ HB_FUNC( QT_QTEXTFRAME_FIRSTPOSITION ) */ HB_FUNC( QT_QTEXTFRAME_FRAMEFORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextFrameFormat( hbqt_par_QTextFrame( 1 )->frameFormat() ), release_QTextFrameFormat ) ); + hb_retptrGC( gcAllocate_QTextFrameFormat( new QTextFrameFormat( hbqt_par_QTextFrame( 1 )->frameFormat() ) ) ); } /* @@ -167,7 +184,7 @@ HB_FUNC( QT_QTEXTFRAME_FRAMEFORMAT ) */ HB_FUNC( QT_QTEXTFRAME_LASTCURSORPOSITION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextCursor( hbqt_par_QTextFrame( 1 )->lastCursorPosition() ), release_QTextCursor ) ); + hb_retptrGC( gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextFrame( 1 )->lastCursorPosition() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextFrameFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextFrameFormat.cpp index e7b32fc574..d8c89e4742 100644 --- a/harbour/contrib/hbqt/qtgui/QTextFrameFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextFrameFormat.cpp @@ -87,40 +87,48 @@ QT_G_FUNC( release_QTextFrameFormat ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextFrameFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrameFormat p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrameFormat ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextFrameFormat * ) ph )->~QTextFrameFormat(); - ph = NULL; + ( ( QTextFrameFormat * ) p->ph )->~QTextFrameFormat(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrameFormat Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextFrameFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextFrameFormat" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextFrameFormat Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextFrameFormat" ); + #endif } } +void * gcAllocate_QTextFrameFormat( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextFrameFormat; + #if defined(__debug__) + just_debug( " new_QTextFrameFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTFRAMEFORMAT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextFrameFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextFrameFormat* ) new QTextFrameFormat() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextFrameFormat; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextFrameFormat( pObj ) ); } /* * qreal border () const @@ -135,7 +143,7 @@ HB_FUNC( QT_QTEXTFRAMEFORMAT_BORDER ) */ HB_FUNC( QT_QTEXTFRAMEFORMAT_BORDERBRUSH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QTextFrameFormat( 1 )->borderBrush() ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QTextFrameFormat( 1 )->borderBrush() ) ) ); } /* @@ -159,7 +167,7 @@ HB_FUNC( QT_QTEXTFRAMEFORMAT_BOTTOMMARGIN ) */ HB_FUNC( QT_QTEXTFRAMEFORMAT_HEIGHT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextLength( hbqt_par_QTextFrameFormat( 1 )->height() ), release_QTextLength ) ); + hb_retptrGC( gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFrameFormat( 1 )->height() ) ) ); } /* @@ -351,7 +359,7 @@ HB_FUNC( QT_QTEXTFRAMEFORMAT_TOPMARGIN ) */ HB_FUNC( QT_QTEXTFRAMEFORMAT_WIDTH ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextLength( hbqt_par_QTextFrameFormat( 1 )->width() ), release_QTextLength ) ); + hb_retptrGC( gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFrameFormat( 1 )->width() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QTextImageFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextImageFormat.cpp index 67148ce89c..1e67364653 100644 --- a/harbour/contrib/hbqt/qtgui/QTextImageFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextImageFormat.cpp @@ -78,40 +78,48 @@ QT_G_FUNC( release_QTextImageFormat ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextImageFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextImageFormat p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextImageFormat ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextImageFormat * ) ph )->~QTextImageFormat(); - ph = NULL; + ( ( QTextImageFormat * ) p->ph )->~QTextImageFormat(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextImageFormat Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextImageFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextImageFormat" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextImageFormat Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextImageFormat" ); + #endif } } +void * gcAllocate_QTextImageFormat( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextImageFormat; + #if defined(__debug__) + just_debug( " new_QTextImageFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTIMAGEFORMAT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextImageFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextImageFormat* ) new QTextImageFormat() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextImageFormat; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextImageFormat( pObj ) ); } /* * qreal height () const diff --git a/harbour/contrib/hbqt/qtgui/QTextInlineObject.cpp b/harbour/contrib/hbqt/qtgui/QTextInlineObject.cpp index 13a2594aeb..cdc0aafca5 100644 --- a/harbour/contrib/hbqt/qtgui/QTextInlineObject.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextInlineObject.cpp @@ -78,21 +78,7 @@ QT_G_FUNC( release_QTextInlineObject ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextInlineObject %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - ( ( QTextInlineObject * ) ph )->~QTextInlineObject(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextInlineObject" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QTEXTINLINEOBJECT ) @@ -119,7 +105,7 @@ HB_FUNC( QT_QTEXTINLINEOBJECT_DESCENT ) */ HB_FUNC( QT_QTEXTINLINEOBJECT_FORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextFormat( hbqt_par_QTextInlineObject( 1 )->format() ), release_QTextFormat ) ); + hb_retptrGC( gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QTextInlineObject( 1 )->format() ) ) ); } /* @@ -151,7 +137,7 @@ HB_FUNC( QT_QTEXTINLINEOBJECT_ISVALID ) */ HB_FUNC( QT_QTEXTINLINEOBJECT_RECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QTextInlineObject( 1 )->rect() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QTextInlineObject( 1 )->rect() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextItem.cpp b/harbour/contrib/hbqt/qtgui/QTextItem.cpp index e38be9dd04..90e0e8911c 100644 --- a/harbour/contrib/hbqt/qtgui/QTextItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextItem.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QTextItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextItem * ) ph )->~QTextItem(); - ph = NULL; + ( ( QTextItem * ) p->ph )->~QTextItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextItem" ); + #endif } } +void * gcAllocate_QTextItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextItem; + #if defined(__debug__) + just_debug( " new_QTextItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextItem* ) new QTextItem() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextItem( pObj ) ); } /* * qreal ascent () const @@ -139,7 +147,7 @@ HB_FUNC( QT_QTEXTITEM_DESCENT ) */ HB_FUNC( QT_QTEXTITEM_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QTextItem( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QTextItem( 1 )->font() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextLayout.cpp b/harbour/contrib/hbqt/qtgui/QTextLayout.cpp index 70e510320d..08348818b5 100644 --- a/harbour/contrib/hbqt/qtgui/QTextLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextLayout.cpp @@ -95,40 +95,48 @@ QT_G_FUNC( release_QTextLayout ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLayout p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLayout ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextLayout * ) ph )->~QTextLayout(); - ph = NULL; + ( ( QTextLayout * ) p->ph )->~QTextLayout(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLayout Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLayout Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextLayout" ); + #endif } } +void * gcAllocate_QTextLayout( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextLayout; + #if defined(__debug__) + just_debug( " new_QTextLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTLAYOUT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextLayout* ) new QTextLayout() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextLayout; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextLayout( pObj ) ); } /* * void beginLayout () @@ -143,7 +151,7 @@ HB_FUNC( QT_QTEXTLAYOUT_BEGINLAYOUT ) */ HB_FUNC( QT_QTEXTLAYOUT_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QTextLayout( 1 )->boundingRect() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QTextLayout( 1 )->boundingRect() ) ) ); } /* @@ -175,7 +183,7 @@ HB_FUNC( QT_QTEXTLAYOUT_CLEARLAYOUT ) */ HB_FUNC( QT_QTEXTLAYOUT_CREATELINE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextLine( hbqt_par_QTextLayout( 1 )->createLine() ), release_QTextLine ) ); + hb_retptrGC( gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->createLine() ) ) ); } /* @@ -207,7 +215,7 @@ HB_FUNC( QT_QTEXTLAYOUT_ENDLAYOUT ) */ HB_FUNC( QT_QTEXTLAYOUT_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QTextLayout( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QTextLayout( 1 )->font() ) ) ); } /* @@ -223,7 +231,7 @@ HB_FUNC( QT_QTEXTLAYOUT_ISVALIDCURSORPOSITION ) */ HB_FUNC( QT_QTEXTLAYOUT_LINEAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextLine( hbqt_par_QTextLayout( 1 )->lineAt( hb_parni( 2 ) ) ), release_QTextLine ) ); + hb_retptrGC( gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->lineAt( hb_parni( 2 ) ) ) ) ); } /* @@ -239,7 +247,7 @@ HB_FUNC( QT_QTEXTLAYOUT_LINECOUNT ) */ HB_FUNC( QT_QTEXTLAYOUT_LINEFORTEXTPOSITION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextLine( hbqt_par_QTextLayout( 1 )->lineForTextPosition( hb_parni( 2 ) ) ), release_QTextLine ) ); + hb_retptrGC( gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->lineForTextPosition( hb_parni( 2 ) ) ) ) ); } /* @@ -271,7 +279,7 @@ HB_FUNC( QT_QTEXTLAYOUT_NEXTCURSORPOSITION ) */ HB_FUNC( QT_QTEXTLAYOUT_POSITION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QTextLayout( 1 )->position() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QTextLayout( 1 )->position() ) ) ); } /* @@ -359,7 +367,7 @@ HB_FUNC( QT_QTEXTLAYOUT_TEXT ) */ HB_FUNC( QT_QTEXTLAYOUT_TEXTOPTION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextOption( hbqt_par_QTextLayout( 1 )->textOption() ), release_QTextOption ) ); + hb_retptrGC( gcAllocate_QTextOption( new QTextOption( hbqt_par_QTextLayout( 1 )->textOption() ) ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QTextLength.cpp b/harbour/contrib/hbqt/qtgui/QTextLength.cpp index 84088f4cb0..29aef24f30 100644 --- a/harbour/contrib/hbqt/qtgui/QTextLength.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextLength.cpp @@ -82,40 +82,48 @@ QT_G_FUNC( release_QTextLength ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextLength %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLength p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLength ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextLength * ) ph )->~QTextLength(); - ph = NULL; + ( ( QTextLength * ) p->ph )->~QTextLength(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLength Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextLength %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextLength" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLength Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextLength" ); + #endif } } +void * gcAllocate_QTextLength( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextLength; + #if defined(__debug__) + just_debug( " new_QTextLength %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTLENGTH ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextLength %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextLength* ) new QTextLength() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextLength; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextLength( pObj ) ); } /* * qreal rawValue () const diff --git a/harbour/contrib/hbqt/qtgui/QTextLine.cpp b/harbour/contrib/hbqt/qtgui/QTextLine.cpp index 5dbc3208c5..5e45471b89 100644 --- a/harbour/contrib/hbqt/qtgui/QTextLine.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextLine.cpp @@ -82,40 +82,48 @@ QT_G_FUNC( release_QTextLine ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextLine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLine p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLine ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextLine * ) ph )->~QTextLine(); - ph = NULL; + ( ( QTextLine * ) p->ph )->~QTextLine(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLine Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextLine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextLine" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextLine Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextLine" ); + #endif } } +void * gcAllocate_QTextLine( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextLine; + #if defined(__debug__) + just_debug( " new_QTextLine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTLINE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextLine %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QTextLine* ) new QTextLine() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextLine; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextLine( pObj ) ); } /* * qreal ascent () const @@ -182,7 +190,7 @@ HB_FUNC( QT_QTEXTLINE_LINENUMBER ) */ HB_FUNC( QT_QTEXTLINE_NATURALTEXTRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QTextLine( 1 )->naturalTextRect() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QTextLine( 1 )->naturalTextRect() ) ) ); } /* @@ -198,7 +206,7 @@ HB_FUNC( QT_QTEXTLINE_NATURALTEXTWIDTH ) */ HB_FUNC( QT_QTEXTLINE_POSITION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QTextLine( 1 )->position() ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QTextLine( 1 )->position() ) ) ); } /* @@ -206,7 +214,7 @@ HB_FUNC( QT_QTEXTLINE_POSITION ) */ HB_FUNC( QT_QTEXTLINE_RECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QTextLine( 1 )->rect() ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QTextLine( 1 )->rect() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextListFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextListFormat.cpp index 412e5897b7..30d337fe2e 100644 --- a/harbour/contrib/hbqt/qtgui/QTextListFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextListFormat.cpp @@ -81,40 +81,48 @@ QT_G_FUNC( release_QTextListFormat ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextListFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextListFormat p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextListFormat ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextListFormat * ) ph )->~QTextListFormat(); - ph = NULL; + ( ( QTextListFormat * ) p->ph )->~QTextListFormat(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextListFormat Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextListFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextListFormat" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextListFormat Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextListFormat" ); + #endif } } +void * gcAllocate_QTextListFormat( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextListFormat; + #if defined(__debug__) + just_debug( " new_QTextListFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTLISTFORMAT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextListFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QTextListFormat() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextListFormat; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextListFormat( pObj ) ); } /* * int indent () const diff --git a/harbour/contrib/hbqt/qtgui/QTextObject.cpp b/harbour/contrib/hbqt/qtgui/QTextObject.cpp index 2c7c8747e2..e5a89c7ecb 100644 --- a/harbour/contrib/hbqt/qtgui/QTextObject.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextObject.cpp @@ -96,7 +96,7 @@ HB_FUNC( QT_QTEXTOBJECT_DOCUMENT ) */ HB_FUNC( QT_QTEXTOBJECT_FORMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTextFormat( hbqt_par_QTextObject( 1 )->format() ), release_QTextFormat ) ); + hb_retptrGC( gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QTextObject( 1 )->format() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextOption.cpp b/harbour/contrib/hbqt/qtgui/QTextOption.cpp index 3024e41a15..1ca1e3c89b 100644 --- a/harbour/contrib/hbqt/qtgui/QTextOption.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextOption.cpp @@ -99,40 +99,48 @@ QT_G_FUNC( release_QTextOption ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextOption %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextOption p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextOption ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextOption * ) ph )->~QTextOption(); - ph = NULL; + ( ( QTextOption * ) p->ph )->~QTextOption(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextOption Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextOption %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextOption" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextOption Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextOption" ); + #endif } } +void * gcAllocate_QTextOption( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextOption; + #if defined(__debug__) + just_debug( " new_QTextOption %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTOPTION ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextOption %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QTextOption() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextOption; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextOption( pObj ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QTextTableFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextTableFormat.cpp index 4924245fa7..6ac3b09f17 100644 --- a/harbour/contrib/hbqt/qtgui/QTextTableFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextTableFormat.cpp @@ -86,40 +86,48 @@ QT_G_FUNC( release_QTextTableFormat ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTextTableFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTextTableFormat p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTextTableFormat ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTextTableFormat * ) ph )->~QTextTableFormat(); - ph = NULL; + ( ( QTextTableFormat * ) p->ph )->~QTextTableFormat(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTextTableFormat Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTextTableFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTextTableFormat" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTextTableFormat Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTextTableFormat" ); + #endif } } +void * gcAllocate_QTextTableFormat( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTextTableFormat; + #if defined(__debug__) + just_debug( " new_QTextTableFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTEXTTABLEFORMAT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTextTableFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QTextTableFormat() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTextTableFormat; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTextTableFormat( pObj ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QTimeEdit.cpp b/harbour/contrib/hbqt/qtgui/QTimeEdit.cpp index 8b57a8ecfe..41f1608adf 100644 --- a/harbour/contrib/hbqt/qtgui/QTimeEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QTimeEdit.cpp @@ -76,55 +76,72 @@ * QTimeEdit ( const QTime & time, QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTimeEdit > pq; +} QGC_POINTER_QTimeEdit; + QT_G_FUNC( release_QTimeEdit ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTimeEdit * p = ( QGC_POINTER_QTimeEdit * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTimeEdit p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTimeEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTimeEdit * ) ph )->~QTimeEdit(); - ph = NULL; + ( ( QTimeEdit * ) p->ph )->~QTimeEdit(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTimeEdit Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTimeEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTimeEdit Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTimeEdit" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTimeEdit" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTimeEdit Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTimeEdit" ); + #endif } } +void * gcAllocate_QTimeEdit( void * pObj ) +{ + QGC_POINTER_QTimeEdit * p = ( QGC_POINTER_QTimeEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QTimeEdit ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTimeEdit; + new( & p->pq ) QPointer< QTimeEdit >( ( QTimeEdit * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTIMEEDIT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTimeEdit > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTimeEdit* ) new QTimeEdit( hbqt_par_QWidget( 1 ) ) ; #if 0 pObj = (QTimeEdit *) new QTimeEdit( QTime( hbqt_par_QString( 1 ) ), hbqt_par_QWidget( 2 ) ) ; #endif -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTimeEdit; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTimeEdit( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QToolBar.cpp b/harbour/contrib/hbqt/qtgui/QToolBar.cpp index fd461cc88c..3d2181524d 100644 --- a/harbour/contrib/hbqt/qtgui/QToolBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QToolBar.cpp @@ -77,55 +77,72 @@ * ~QToolBar () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QToolBar > pq; +} QGC_POINTER_QToolBar; + QT_G_FUNC( release_QToolBar ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QToolBar * p = ( QGC_POINTER_QToolBar * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBar p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBar ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QToolBar * ) ph )->~QToolBar(); - ph = NULL; + ( ( QToolBar * ) p->ph )->~QToolBar(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBar Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QToolBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBar Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QToolBar" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QToolBar" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBar Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QToolBar" ); + #endif } } +void * gcAllocate_QToolBar( void * pObj ) +{ + QGC_POINTER_QToolBar * p = ( QGC_POINTER_QToolBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QToolBar ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QToolBar; + new( & p->pq ) QPointer< QToolBar >( ( QToolBar * ) pObj ); + #if defined(__debug__) + just_debug( " new_QToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTOOLBAR ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QToolBar > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; if( hb_param( 1, HB_IT_STRING ) ) pObj = ( QToolBar* ) new QToolBar( hbqt_par_QString( 1 ), hbqt_par_QWidget( 2 ) ) ; else pObj = ( QToolBar* ) new QToolBar( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QToolBar; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QToolBar( pObj ) ); } /* * QAction * actionAt ( const QPoint & p ) const @@ -220,7 +237,7 @@ HB_FUNC( QT_QTOOLBAR_CLEAR ) */ HB_FUNC( QT_QTOOLBAR_ICONSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QToolBar( 1 )->iconSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QToolBar( 1 )->iconSize() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QToolBox.cpp b/harbour/contrib/hbqt/qtgui/QToolBox.cpp index 79fb4eb376..48d4f42c43 100644 --- a/harbour/contrib/hbqt/qtgui/QToolBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QToolBox.cpp @@ -76,52 +76,69 @@ * ~QToolBox () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QToolBox > pq; +} QGC_POINTER_QToolBox; + QT_G_FUNC( release_QToolBox ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QToolBox * p = ( QGC_POINTER_QToolBox * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBox p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBox ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QToolBox * ) ph )->~QToolBox(); - ph = NULL; + ( ( QToolBox * ) p->ph )->~QToolBox(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBox Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QToolBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBox Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QToolBox" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QToolBox" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QToolBox Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QToolBox" ); + #endif } } +void * gcAllocate_QToolBox( void * pObj ) +{ + QGC_POINTER_QToolBox * p = ( QGC_POINTER_QToolBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QToolBox ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QToolBox; + new( & p->pq ) QPointer< QToolBox >( ( QToolBox * ) pObj ); + #if defined(__debug__) + just_debug( " new_QToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTOOLBOX ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QToolBox > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QToolBox* ) new QToolBox( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QToolBox; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QToolBox( pObj ) ); } /* * int addItem ( QWidget * widget, const QIcon & iconSet, const QString & text ) @@ -200,7 +217,7 @@ HB_FUNC( QT_QTOOLBOX_ISITEMENABLED ) */ HB_FUNC( QT_QTOOLBOX_ITEMICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QToolBox( 1 )->itemIcon( hb_parni( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QToolBox( 1 )->itemIcon( hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QToolButton.cpp b/harbour/contrib/hbqt/qtgui/QToolButton.cpp index 42997ae2b7..7872423706 100644 --- a/harbour/contrib/hbqt/qtgui/QToolButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QToolButton.cpp @@ -80,52 +80,69 @@ * ~QToolButton () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QToolButton > pq; +} QGC_POINTER_QToolButton; + QT_G_FUNC( release_QToolButton ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QToolButton * p = ( QGC_POINTER_QToolButton * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QToolButton p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QToolButton ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QToolButton * ) ph )->~QToolButton(); - ph = NULL; + ( ( QToolButton * ) p->ph )->~QToolButton(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QToolButton Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QToolButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QToolButton Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QToolButton" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QToolButton" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QToolButton Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QToolButton" ); + #endif } } +void * gcAllocate_QToolButton( void * pObj ) +{ + QGC_POINTER_QToolButton * p = ( QGC_POINTER_QToolButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QToolButton ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QToolButton; + new( & p->pq ) QPointer< QToolButton >( ( QToolButton * ) pObj ); + #if defined(__debug__) + just_debug( " new_QToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTOOLBUTTON ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QToolButton > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QToolButton* ) new QToolButton( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QToolButton; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QToolButton( pObj ) ); } /* * Qt::ArrowType arrowType () const diff --git a/harbour/contrib/hbqt/qtgui/QTransform.cpp b/harbour/contrib/hbqt/qtgui/QTransform.cpp index cedbcc0d83..4b2f11d926 100644 --- a/harbour/contrib/hbqt/qtgui/QTransform.cpp +++ b/harbour/contrib/hbqt/qtgui/QTransform.cpp @@ -83,40 +83,48 @@ QT_G_FUNC( release_QTransform ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTransform %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTransform p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTransform ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTransform * ) ph )->~QTransform(); - ph = NULL; + ( ( QTransform * ) p->ph )->~QTransform(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTransform Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTransform %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTransform" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTransform Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTransform" ); + #endif } } +void * gcAllocate_QTransform( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTransform; + #if defined(__debug__) + just_debug( " new_QTransform %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTRANSFORM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTransform %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QTransform() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTransform; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTransform( pObj ) ); } /* * qreal m11 () const @@ -195,7 +203,7 @@ HB_FUNC( QT_QTRANSFORM_M33 ) */ HB_FUNC( QT_QTRANSFORM_ADJOINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->adjoint() ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->adjoint() ) ) ); } /* @@ -237,7 +245,7 @@ HB_FUNC( QT_QTRANSFORM_INVERTED ) { bool iInvertible = 0; - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->inverted( &iInvertible ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->inverted( &iInvertible ) ) ) ); hb_stornl( iInvertible, 2 ); } @@ -309,7 +317,7 @@ HB_FUNC( QT_QTRANSFORM_MAP ) */ HB_FUNC( QT_QTRANSFORM_MAP_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPointF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPointF( 2 ) ) ), release_QPointF ) ); + hb_retptrGC( gcAllocate_QPointF( new QPointF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPointF( 2 ) ) ) ) ); } /* @@ -317,7 +325,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_1 ) */ HB_FUNC( QT_QTRANSFORM_MAP_2 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPoint( 2 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -325,7 +333,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_2 ) */ HB_FUNC( QT_QTRANSFORM_MAP_3 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLine( hbqt_par_QTransform( 1 )->map( *hbqt_par_QLine( 2 ) ) ), release_QLine ) ); + hb_retptrGC( gcAllocate_QLine( new QLine( hbqt_par_QTransform( 1 )->map( *hbqt_par_QLine( 2 ) ) ) ) ); } /* @@ -333,7 +341,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_3 ) */ HB_FUNC( QT_QTRANSFORM_MAP_4 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLineF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QLineF( 2 ) ) ), release_QLineF ) ); + hb_retptrGC( gcAllocate_QLineF( new QLineF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QLineF( 2 ) ) ) ) ); } /* @@ -341,7 +349,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_4 ) */ HB_FUNC( QT_QTRANSFORM_MAP_5 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygonF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPolygonF( 2 ) ) ), release_QPolygonF ) ); + hb_retptrGC( gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPolygonF( 2 ) ) ) ) ); } /* @@ -349,7 +357,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_5 ) */ HB_FUNC( QT_QTRANSFORM_MAP_6 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygon( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPolygon( 2 ) ) ), release_QPolygon ) ); + hb_retptrGC( gcAllocate_QPolygon( new QPolygon( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPolygon( 2 ) ) ) ) ); } /* @@ -357,7 +365,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_6 ) */ HB_FUNC( QT_QTRANSFORM_MAP_7 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QTransform( 1 )->map( *hbqt_par_QRegion( 2 ) ) ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QTransform( 1 )->map( *hbqt_par_QRegion( 2 ) ) ) ) ); } /* @@ -365,7 +373,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_7 ) */ HB_FUNC( QT_QTRANSFORM_MAP_8 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPainterPath( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPainterPath( 2 ) ) ), release_QPainterPath ) ); + hb_retptrGC( gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPainterPath( 2 ) ) ) ) ); } /* @@ -387,7 +395,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_9 ) */ HB_FUNC( QT_QTRANSFORM_MAPRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRectF( hbqt_par_QTransform( 1 )->mapRect( *hbqt_par_QRectF( 2 ) ) ), release_QRectF ) ); + hb_retptrGC( gcAllocate_QRectF( new QRectF( hbqt_par_QTransform( 1 )->mapRect( *hbqt_par_QRectF( 2 ) ) ) ) ); } /* @@ -395,7 +403,7 @@ HB_FUNC( QT_QTRANSFORM_MAPRECT ) */ HB_FUNC( QT_QTRANSFORM_MAPRECT_1 ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QTransform( 1 )->mapRect( *hbqt_par_QRect( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QTransform( 1 )->mapRect( *hbqt_par_QRect( 2 ) ) ) ) ); } /* @@ -403,7 +411,7 @@ HB_FUNC( QT_QTRANSFORM_MAPRECT_1 ) */ HB_FUNC( QT_QTRANSFORM_MAPTOPOLYGON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPolygon( hbqt_par_QTransform( 1 )->mapToPolygon( *hbqt_par_QRect( 2 ) ) ), release_QPolygon ) ); + hb_retptrGC( gcAllocate_QPolygon( new QPolygon( hbqt_par_QTransform( 1 )->mapToPolygon( *hbqt_par_QRect( 2 ) ) ) ) ); } /* @@ -419,7 +427,7 @@ HB_FUNC( QT_QTRANSFORM_RESET ) */ HB_FUNC( QT_QTRANSFORM_ROTATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->rotate( hb_parnd( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::Axis ) hb_parni( 3 ) : ( Qt::Axis ) Qt::ZAxis ) ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->rotate( hb_parnd( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::Axis ) hb_parni( 3 ) : ( Qt::Axis ) Qt::ZAxis ) ) ) ) ); } /* @@ -427,7 +435,7 @@ HB_FUNC( QT_QTRANSFORM_ROTATE ) */ HB_FUNC( QT_QTRANSFORM_ROTATERADIANS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->rotateRadians( hb_parnd( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::Axis ) hb_parni( 3 ) : ( Qt::Axis ) Qt::ZAxis ) ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->rotateRadians( hb_parnd( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::Axis ) hb_parni( 3 ) : ( Qt::Axis ) Qt::ZAxis ) ) ) ) ); } /* @@ -435,7 +443,7 @@ HB_FUNC( QT_QTRANSFORM_ROTATERADIANS ) */ HB_FUNC( QT_QTRANSFORM_SCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->scale( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->scale( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* @@ -451,7 +459,7 @@ HB_FUNC( QT_QTRANSFORM_SETMATRIX ) */ HB_FUNC( QT_QTRANSFORM_SHEAR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->shear( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->shear( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* @@ -459,7 +467,7 @@ HB_FUNC( QT_QTRANSFORM_SHEAR ) */ HB_FUNC( QT_QTRANSFORM_TOAFFINE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QMatrix( hbqt_par_QTransform( 1 )->toAffine() ), release_QMatrix ) ); + hb_retptrGC( gcAllocate_QMatrix( new QMatrix( hbqt_par_QTransform( 1 )->toAffine() ) ) ); } /* @@ -467,7 +475,7 @@ HB_FUNC( QT_QTRANSFORM_TOAFFINE ) */ HB_FUNC( QT_QTRANSFORM_TRANSLATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->translate( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->translate( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* @@ -475,7 +483,7 @@ HB_FUNC( QT_QTRANSFORM_TRANSLATE ) */ HB_FUNC( QT_QTRANSFORM_TRANSPOSED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->transposed() ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->transposed() ) ) ); } /* @@ -491,7 +499,7 @@ HB_FUNC( QT_QTRANSFORM_TYPE ) */ HB_FUNC( QT_QTRANSFORM_FROMSCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->fromScale( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->fromScale( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* @@ -499,7 +507,7 @@ HB_FUNC( QT_QTRANSFORM_FROMSCALE ) */ HB_FUNC( QT_QTRANSFORM_FROMTRANSLATE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QTransform( hbqt_par_QTransform( 1 )->fromTranslate( hb_parnd( 2 ), hb_parnd( 3 ) ) ), release_QTransform ) ); + hb_retptrGC( gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->fromTranslate( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTreeView.cpp b/harbour/contrib/hbqt/qtgui/QTreeView.cpp index 9c5800fee5..95764d66d0 100644 --- a/harbour/contrib/hbqt/qtgui/QTreeView.cpp +++ b/harbour/contrib/hbqt/qtgui/QTreeView.cpp @@ -88,52 +88,69 @@ * ~QTreeView () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTreeView > pq; +} QGC_POINTER_QTreeView; + QT_G_FUNC( release_QTreeView ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTreeView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTreeView * p = ( QGC_POINTER_QTreeView * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeView p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeView ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTreeView * ) ph )->~QTreeView(); - ph = NULL; + ( ( QTreeView * ) p->ph )->~QTreeView(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeView Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTreeView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTreeView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeView Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTreeView" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTreeView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeView Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTreeView" ); + #endif } } +void * gcAllocate_QTreeView( void * pObj ) +{ + QGC_POINTER_QTreeView * p = ( QGC_POINTER_QTreeView * ) hb_gcAllocate( sizeof( QGC_POINTER_QTreeView ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTreeView; + new( & p->pq ) QPointer< QTreeView >( ( QTreeView * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTreeView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTREEVIEW ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTreeView > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTreeView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTreeView* ) new QTreeView( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTreeView; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTreeView( pObj ) ); } /* * bool allColumnsShowFocus () const @@ -204,7 +221,7 @@ HB_FUNC( QT_QTREEVIEW_INDENTATION ) */ HB_FUNC( QT_QTREEVIEW_INDEXABOVE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QTreeView( 1 )->indexAbove( *hbqt_par_QModelIndex( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTreeView( 1 )->indexAbove( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -212,7 +229,7 @@ HB_FUNC( QT_QTREEVIEW_INDEXABOVE ) */ HB_FUNC( QT_QTREEVIEW_INDEXBELOW ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_QTreeView( 1 )->indexBelow( *hbqt_par_QModelIndex( 2 ) ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTreeView( 1 )->indexBelow( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* @@ -452,7 +469,7 @@ HB_FUNC( QT_QTREEVIEW_UNIFORMROWHEIGHTS ) */ HB_FUNC( QT_QTREEVIEW_VISUALRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QTreeView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QTreeView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTreeWidget.cpp b/harbour/contrib/hbqt/qtgui/QTreeWidget.cpp index 43a65849d6..ccfe46de20 100644 --- a/harbour/contrib/hbqt/qtgui/QTreeWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QTreeWidget.cpp @@ -88,52 +88,69 @@ * ~QTreeWidget () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QTreeWidget > pq; +} QGC_POINTER_QTreeWidget; + QT_G_FUNC( release_QTreeWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTreeWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QTreeWidget * p = ( QGC_POINTER_QTreeWidget * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidget p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QTreeWidget * ) ph )->~QTreeWidget(); - ph = NULL; + ( ( QTreeWidget * ) p->ph )->~QTreeWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTreeWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QTreeWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidget Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QTreeWidget" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTreeWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTreeWidget" ); + #endif } } +void * gcAllocate_QTreeWidget( void * pObj ) +{ + QGC_POINTER_QTreeWidget * p = ( QGC_POINTER_QTreeWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QTreeWidget ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTreeWidget; + new( & p->pq ) QPointer< QTreeWidget >( ( QTreeWidget * ) pObj ); + #if defined(__debug__) + just_debug( " new_QTreeWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTREEWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QTreeWidget > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTreeWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QTreeWidget* ) new QTreeWidget( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTreeWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTreeWidget( pObj ) ); } /* * void addTopLevelItem ( QTreeWidgetItem * item ) @@ -396,7 +413,7 @@ HB_FUNC( QT_QTREEWIDGET_TOPLEVELITEMCOUNT ) */ HB_FUNC( QT_QTREEWIDGET_VISUALITEMRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QTreeWidget( 1 )->visualItemRect( hbqt_par_QTreeWidgetItem( 2 ) ) ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QTreeWidget( 1 )->visualItemRect( hbqt_par_QTreeWidgetItem( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTreeWidgetItem.cpp b/harbour/contrib/hbqt/qtgui/QTreeWidgetItem.cpp index cd00138bff..8026c69bfb 100644 --- a/harbour/contrib/hbqt/qtgui/QTreeWidgetItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QTreeWidgetItem.cpp @@ -102,30 +102,44 @@ QT_G_FUNC( release_QTreeWidgetItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QTreeWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidgetItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidgetItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QTreeWidgetItem * ) ph )->~QTreeWidgetItem(); - ph = NULL; + ( ( QTreeWidgetItem * ) p->ph )->~QTreeWidgetItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidgetItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QTreeWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QTreeWidgetItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QTreeWidgetItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QTreeWidgetItem" ); + #endif } } +void * gcAllocate_QTreeWidgetItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QTreeWidgetItem; + #if defined(__debug__) + just_debug( " new_QTreeWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QTREEWIDGETITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QTreeWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() >= 1 && HB_ISNUM( 1 ) ) { @@ -136,13 +150,7 @@ hb_snprintf( str, sizeof(str), " GC: new QTreeWidgetItem %i B %i pObj = ( QTreeWidgetItem* ) new QTreeWidgetItem( hbqt_par_QTreeWidget( 1 ), hb_parni( 2 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QTreeWidgetItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QTreeWidgetItem( pObj ) ); } /* * void addChild ( QTreeWidgetItem * child ) @@ -157,7 +165,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_ADDCHILD ) */ HB_FUNC( QT_QTREEWIDGETITEM_BACKGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QTreeWidgetItem( 1 )->background( hb_parni( 2 ) ) ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QTreeWidgetItem( 1 )->background( hb_parni( 2 ) ) ) ) ); } /* @@ -213,7 +221,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_COLUMNCOUNT ) */ HB_FUNC( QT_QTREEWIDGETITEM_DATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QTreeWidgetItem( 1 )->data( hb_parni( 2 ), hb_parni( 3 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QTreeWidgetItem( 1 )->data( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); } /* @@ -229,7 +237,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_FLAGS ) */ HB_FUNC( QT_QTREEWIDGETITEM_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QTreeWidgetItem( 1 )->font( hb_parni( 2 ) ) ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QTreeWidgetItem( 1 )->font( hb_parni( 2 ) ) ) ) ); } /* @@ -237,7 +245,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_FONT ) */ HB_FUNC( QT_QTREEWIDGETITEM_FOREGROUND ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QBrush( hbqt_par_QTreeWidgetItem( 1 )->foreground( hb_parni( 2 ) ) ), release_QBrush ) ); + hb_retptrGC( gcAllocate_QBrush( new QBrush( hbqt_par_QTreeWidgetItem( 1 )->foreground( hb_parni( 2 ) ) ) ) ); } /* @@ -245,7 +253,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_FOREGROUND ) */ HB_FUNC( QT_QTREEWIDGETITEM_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QTreeWidgetItem( 1 )->icon( hb_parni( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QTreeWidgetItem( 1 )->icon( hb_parni( 2 ) ) ) ) ); } /* @@ -485,7 +493,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_SETWHATSTHIS ) */ HB_FUNC( QT_QTREEWIDGETITEM_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QTreeWidgetItem( 1 )->sizeHint( hb_parni( 2 ) ) ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QTreeWidgetItem( 1 )->sizeHint( hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QVBoxLayout.cpp b/harbour/contrib/hbqt/qtgui/QVBoxLayout.cpp index f038268abf..b2ebc287cf 100644 --- a/harbour/contrib/hbqt/qtgui/QVBoxLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QVBoxLayout.cpp @@ -77,52 +77,69 @@ * ~QVBoxLayout () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QVBoxLayout > pq; +} QGC_POINTER_QVBoxLayout; + QT_G_FUNC( release_QVBoxLayout ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QVBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QVBoxLayout * p = ( QGC_POINTER_QVBoxLayout * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QVBoxLayout p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QVBoxLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QVBoxLayout * ) ph )->~QVBoxLayout(); - ph = NULL; + ( ( QVBoxLayout * ) p->ph )->~QVBoxLayout(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QVBoxLayout Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QVBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QVBoxLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QVBoxLayout Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QVBoxLayout" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QVBoxLayout" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QVBoxLayout Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QVBoxLayout" ); + #endif } } +void * gcAllocate_QVBoxLayout( void * pObj ) +{ + QGC_POINTER_QVBoxLayout * p = ( QGC_POINTER_QVBoxLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QVBoxLayout ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QVBoxLayout; + new( & p->pq ) QPointer< QVBoxLayout >( ( QVBoxLayout * ) pObj ); + #if defined(__debug__) + just_debug( " new_QVBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QVBOXLAYOUT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QVBoxLayout > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QVBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QVBoxLayout* ) new QVBoxLayout( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QVBoxLayout; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QVBoxLayout( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QValidator.cpp b/harbour/contrib/hbqt/qtgui/QValidator.cpp index 2809bbe18d..89459dd795 100644 --- a/harbour/contrib/hbqt/qtgui/QValidator.cpp +++ b/harbour/contrib/hbqt/qtgui/QValidator.cpp @@ -81,31 +81,7 @@ QT_G_FUNC( release_QValidator ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QValidator %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QValidator * ) ph )->~QValidator(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QValidator" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QValidator" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QVALIDATOR ) @@ -116,7 +92,7 @@ HB_FUNC( QT_QVALIDATOR ) */ HB_FUNC( QT_QVALIDATOR_LOCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLocale( hbqt_par_QValidator( 1 )->locale() ), release_QLocale ) ); + hb_retptrGC( gcAllocate_QLocale( new QLocale( hbqt_par_QValidator( 1 )->locale() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWheelEvent.cpp b/harbour/contrib/hbqt/qtgui/QWheelEvent.cpp index c986b96572..12555b9d3f 100644 --- a/harbour/contrib/hbqt/qtgui/QWheelEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QWheelEvent.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QWheelEvent ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWheelEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QWheelEvent * ) ph )->~QWheelEvent(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWheelEvent" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWheelEvent" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QWHEELEVENT ) @@ -129,7 +105,7 @@ HB_FUNC( QT_QWHEELEVENT_DELTA ) */ HB_FUNC( QT_QWHEELEVENT_GLOBALPOS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWheelEvent( 1 )->globalPos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWheelEvent( 1 )->globalPos() ) ) ); } /* @@ -161,7 +137,7 @@ HB_FUNC( QT_QWHEELEVENT_ORIENTATION ) */ HB_FUNC( QT_QWHEELEVENT_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWheelEvent( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWheelEvent( 1 )->pos() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWidget.cpp b/harbour/contrib/hbqt/qtgui/QWidget.cpp index 482d687c33..6cc189514d 100644 --- a/harbour/contrib/hbqt/qtgui/QWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QWidget.cpp @@ -114,52 +114,69 @@ * ~QWidget () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QWidget > pq; +} QGC_POINTER_QWidget; + QT_G_FUNC( release_QWidget ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QWidget * p = ( QGC_POINTER_QWidget * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWidget p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QWidget * ) ph )->~QWidget(); - ph = NULL; + ( ( QWidget * ) p->ph )->~QWidget(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWidget Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWidget Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QWidget" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWidget" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWidget Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWidget" ); + #endif } } +void * gcAllocate_QWidget( void * pObj ) +{ + QGC_POINTER_QWidget * p = ( QGC_POINTER_QWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QWidget ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWidget; + new( & p->pq ) QPointer< QWidget >( ( QWidget * ) pObj ); + #if defined(__debug__) + just_debug( " new_QWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWIDGET ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QWidget > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QWidget( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWidget; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWidget( pObj ) ); } /* * bool acceptDrops () const @@ -230,7 +247,7 @@ HB_FUNC( QT_QWIDGET_BACKGROUNDROLE ) */ HB_FUNC( QT_QWIDGET_BASESIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWidget( 1 )->baseSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->baseSize() ) ) ); } /* @@ -254,7 +271,7 @@ HB_FUNC( QT_QWIDGET_CHILDAT_1 ) */ HB_FUNC( QT_QWIDGET_CHILDRENRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QWidget( 1 )->childrenRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->childrenRect() ) ) ); } /* @@ -262,7 +279,7 @@ HB_FUNC( QT_QWIDGET_CHILDRENRECT ) */ HB_FUNC( QT_QWIDGET_CHILDRENREGION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QWidget( 1 )->childrenRegion() ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->childrenRegion() ) ) ); } /* @@ -286,7 +303,7 @@ HB_FUNC( QT_QWIDGET_CLEARMASK ) */ HB_FUNC( QT_QWIDGET_CONTENTSRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QWidget( 1 )->contentsRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->contentsRect() ) ) ); } /* @@ -302,7 +319,7 @@ HB_FUNC( QT_QWIDGET_CONTEXTMENUPOLICY ) */ HB_FUNC( QT_QWIDGET_CURSOR ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QCursor( hbqt_par_QWidget( 1 )->cursor() ), release_QCursor ) ); + hb_retptrGC( gcAllocate_QCursor( new QCursor( hbqt_par_QWidget( 1 )->cursor() ) ) ); } /* @@ -342,7 +359,7 @@ HB_FUNC( QT_QWIDGET_FOCUSWIDGET ) */ HB_FUNC( QT_QWIDGET_FONT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFont( hbqt_par_QWidget( 1 )->font() ), release_QFont ) ); + hb_retptrGC( gcAllocate_QFont( new QFont( hbqt_par_QWidget( 1 )->font() ) ) ); } /* @@ -350,7 +367,7 @@ HB_FUNC( QT_QWIDGET_FONT ) */ HB_FUNC( QT_QWIDGET_FONTINFO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFontInfo( hbqt_par_QWidget( 1 )->fontInfo() ), release_QFontInfo ) ); + hb_retptrGC( gcAllocate_QFontInfo( new QFontInfo( hbqt_par_QWidget( 1 )->fontInfo() ) ) ); } /* @@ -358,7 +375,7 @@ HB_FUNC( QT_QWIDGET_FONTINFO ) */ HB_FUNC( QT_QWIDGET_FONTMETRICS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QFontMetrics( hbqt_par_QWidget( 1 )->fontMetrics() ), release_QFontMetrics ) ); + hb_retptrGC( gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QWidget( 1 )->fontMetrics() ) ) ); } /* @@ -374,7 +391,7 @@ HB_FUNC( QT_QWIDGET_FOREGROUNDROLE ) */ HB_FUNC( QT_QWIDGET_FRAMEGEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QWidget( 1 )->frameGeometry() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->frameGeometry() ) ) ); } /* @@ -382,7 +399,7 @@ HB_FUNC( QT_QWIDGET_FRAMEGEOMETRY ) */ HB_FUNC( QT_QWIDGET_FRAMESIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWidget( 1 )->frameSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->frameSize() ) ) ); } /* @@ -390,7 +407,7 @@ HB_FUNC( QT_QWIDGET_FRAMESIZE ) */ HB_FUNC( QT_QWIDGET_GEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QWidget( 1 )->geometry() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->geometry() ) ) ); } /* @@ -496,7 +513,7 @@ HB_FUNC( QT_QWIDGET_INPUTCONTEXT ) */ HB_FUNC( QT_QWIDGET_INPUTMETHODQUERY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QWidget( 1 )->inputMethodQuery( ( Qt::InputMethodQuery ) hb_parni( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QWidget( 1 )->inputMethodQuery( ( Qt::InputMethodQuery ) hb_parni( 2 ) ) ) ) ); } /* @@ -632,7 +649,7 @@ HB_FUNC( QT_QWIDGET_LAYOUTDIRECTION ) */ HB_FUNC( QT_QWIDGET_LOCALE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QLocale( hbqt_par_QWidget( 1 )->locale() ), release_QLocale ) ); + hb_retptrGC( gcAllocate_QLocale( new QLocale( hbqt_par_QWidget( 1 )->locale() ) ) ); } /* @@ -640,7 +657,7 @@ HB_FUNC( QT_QWIDGET_LOCALE ) */ HB_FUNC( QT_QWIDGET_MAPFROM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWidget( 1 )->mapFrom( hbqt_par_QWidget( 2 ), *hbqt_par_QPoint( 3 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFrom( hbqt_par_QWidget( 2 ), *hbqt_par_QPoint( 3 ) ) ) ) ); } /* @@ -648,7 +665,7 @@ HB_FUNC( QT_QWIDGET_MAPFROM ) */ HB_FUNC( QT_QWIDGET_MAPFROMGLOBAL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWidget( 1 )->mapFromGlobal( *hbqt_par_QPoint( 2 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFromGlobal( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -656,7 +673,7 @@ HB_FUNC( QT_QWIDGET_MAPFROMGLOBAL ) */ HB_FUNC( QT_QWIDGET_MAPFROMPARENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWidget( 1 )->mapFromParent( *hbqt_par_QPoint( 2 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFromParent( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -664,7 +681,7 @@ HB_FUNC( QT_QWIDGET_MAPFROMPARENT ) */ HB_FUNC( QT_QWIDGET_MAPTO ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWidget( 1 )->mapTo( hbqt_par_QWidget( 2 ), *hbqt_par_QPoint( 3 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapTo( hbqt_par_QWidget( 2 ), *hbqt_par_QPoint( 3 ) ) ) ) ); } /* @@ -672,7 +689,7 @@ HB_FUNC( QT_QWIDGET_MAPTO ) */ HB_FUNC( QT_QWIDGET_MAPTOGLOBAL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWidget( 1 )->mapToGlobal( *hbqt_par_QPoint( 2 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapToGlobal( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -680,7 +697,7 @@ HB_FUNC( QT_QWIDGET_MAPTOGLOBAL ) */ HB_FUNC( QT_QWIDGET_MAPTOPARENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWidget( 1 )->mapToParent( *hbqt_par_QPoint( 2 ) ) ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapToParent( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -688,7 +705,7 @@ HB_FUNC( QT_QWIDGET_MAPTOPARENT ) */ HB_FUNC( QT_QWIDGET_MASK ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QWidget( 1 )->mask() ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->mask() ) ) ); } /* @@ -704,7 +721,7 @@ HB_FUNC( QT_QWIDGET_MAXIMUMHEIGHT ) */ HB_FUNC( QT_QWIDGET_MAXIMUMSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWidget( 1 )->maximumSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->maximumSize() ) ) ); } /* @@ -728,7 +745,7 @@ HB_FUNC( QT_QWIDGET_MINIMUMHEIGHT ) */ HB_FUNC( QT_QWIDGET_MINIMUMSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWidget( 1 )->minimumSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->minimumSize() ) ) ); } /* @@ -736,7 +753,7 @@ HB_FUNC( QT_QWIDGET_MINIMUMSIZE ) */ HB_FUNC( QT_QWIDGET_MINIMUMSIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWidget( 1 )->minimumSizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->minimumSizeHint() ) ) ); } /* @@ -784,7 +801,7 @@ HB_FUNC( QT_QWIDGET_NEXTINFOCUSCHAIN ) */ HB_FUNC( QT_QWIDGET_NORMALGEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QWidget( 1 )->normalGeometry() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->normalGeometry() ) ) ); } /* @@ -808,7 +825,7 @@ HB_FUNC( QT_QWIDGET_PAINTENGINE ) */ HB_FUNC( QT_QWIDGET_PALETTE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPalette( hbqt_par_QWidget( 1 )->palette() ), release_QPalette ) ); + hb_retptrGC( gcAllocate_QPalette( new QPalette( hbqt_par_QWidget( 1 )->palette() ) ) ); } /* @@ -824,7 +841,7 @@ HB_FUNC( QT_QWIDGET_PARENTWIDGET ) */ HB_FUNC( QT_QWIDGET_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWidget( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->pos() ) ) ); } /* @@ -832,7 +849,7 @@ HB_FUNC( QT_QWIDGET_POS ) */ HB_FUNC( QT_QWIDGET_RECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QWidget( 1 )->rect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->rect() ) ) ); } /* @@ -920,7 +937,7 @@ HB_FUNC( QT_QWIDGET_RESTOREGEOMETRY ) */ HB_FUNC( QT_QWIDGET_SAVEGEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QWidget( 1 )->saveGeometry() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QWidget( 1 )->saveGeometry() ) ) ); } /* @@ -1408,7 +1425,7 @@ HB_FUNC( QT_QWIDGET_SETWINDOWSTATE ) */ HB_FUNC( QT_QWIDGET_SIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWidget( 1 )->size() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->size() ) ) ); } /* @@ -1416,7 +1433,7 @@ HB_FUNC( QT_QWIDGET_SIZE ) */ HB_FUNC( QT_QWIDGET_SIZEHINT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWidget( 1 )->sizeHint() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->sizeHint() ) ) ); } /* @@ -1424,7 +1441,7 @@ HB_FUNC( QT_QWIDGET_SIZEHINT ) */ HB_FUNC( QT_QWIDGET_SIZEINCREMENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWidget( 1 )->sizeIncrement() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->sizeIncrement() ) ) ); } /* @@ -1432,7 +1449,7 @@ HB_FUNC( QT_QWIDGET_SIZEINCREMENT ) */ HB_FUNC( QT_QWIDGET_SIZEPOLICY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSizePolicy( hbqt_par_QWidget( 1 )->sizePolicy() ), release_QSizePolicy ) ); + hb_retptrGC( gcAllocate_QSizePolicy( new QSizePolicy( hbqt_par_QWidget( 1 )->sizePolicy() ) ) ); } /* @@ -1560,7 +1577,7 @@ HB_FUNC( QT_QWIDGET_UPDATESENABLED ) */ HB_FUNC( QT_QWIDGET_VISIBLEREGION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRegion( hbqt_par_QWidget( 1 )->visibleRegion() ), release_QRegion ) ); + hb_retptrGC( gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->visibleRegion() ) ) ); } /* @@ -1608,7 +1625,7 @@ HB_FUNC( QT_QWIDGET_WINDOWFLAGS ) */ HB_FUNC( QT_QWIDGET_WINDOWICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QWidget( 1 )->windowIcon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QWidget( 1 )->windowIcon() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWidgetAction.cpp b/harbour/contrib/hbqt/qtgui/QWidgetAction.cpp index 51ab0918db..ae02acb973 100644 --- a/harbour/contrib/hbqt/qtgui/QWidgetAction.cpp +++ b/harbour/contrib/hbqt/qtgui/QWidgetAction.cpp @@ -76,52 +76,69 @@ * virtual ~QWidgetAction () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QWidgetAction > pq; +} QGC_POINTER_QWidgetAction; + QT_G_FUNC( release_QWidgetAction ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWidgetAction %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QWidgetAction * p = ( QGC_POINTER_QWidgetAction * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetAction p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetAction ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QWidgetAction * ) ph )->~QWidgetAction(); - ph = NULL; + ( ( QWidgetAction * ) p->ph )->~QWidgetAction(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetAction Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWidgetAction %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWidgetAction" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetAction Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QWidgetAction" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWidgetAction" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetAction Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWidgetAction" ); + #endif } } +void * gcAllocate_QWidgetAction( void * pObj ) +{ + QGC_POINTER_QWidgetAction * p = ( QGC_POINTER_QWidgetAction * ) hb_gcAllocate( sizeof( QGC_POINTER_QWidgetAction ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWidgetAction; + new( & p->pq ) QPointer< QWidgetAction >( ( QWidgetAction * ) pObj ); + #if defined(__debug__) + just_debug( " new_QWidgetAction %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWIDGETACTION ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QWidgetAction > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWidgetAction %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QWidgetAction* ) new QWidgetAction( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWidgetAction; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWidgetAction( pObj ) ); } /* * QWidget * defaultWidget () const diff --git a/harbour/contrib/hbqt/qtgui/QWidgetItem.cpp b/harbour/contrib/hbqt/qtgui/QWidgetItem.cpp index 1aae2009e8..11d781efda 100644 --- a/harbour/contrib/hbqt/qtgui/QWidgetItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QWidgetItem.cpp @@ -77,40 +77,48 @@ QT_G_FUNC( release_QWidgetItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QWidgetItem * ) ph )->~QWidgetItem(); - ph = NULL; + ( ( QWidgetItem * ) p->ph )->~QWidgetItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWidgetItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWidgetItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWidgetItem" ); + #endif } } +void * gcAllocate_QWidgetItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWidgetItem; + #if defined(__debug__) + just_debug( " new_QWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWIDGETITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QWidgetItem* ) new QWidgetItem( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWidgetItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWidgetItem( pObj ) ); } /* * virtual bool isEmpty () const diff --git a/harbour/contrib/hbqt/qtgui/QWindowsStyle.cpp b/harbour/contrib/hbqt/qtgui/QWindowsStyle.cpp index c2aa6323fd..1f4211233c 100644 --- a/harbour/contrib/hbqt/qtgui/QWindowsStyle.cpp +++ b/harbour/contrib/hbqt/qtgui/QWindowsStyle.cpp @@ -77,52 +77,69 @@ * */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QWindowsStyle > pq; +} QGC_POINTER_QWindowsStyle; + QT_G_FUNC( release_QWindowsStyle ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWindowsStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QWindowsStyle * p = ( QGC_POINTER_QWindowsStyle * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsStyle p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsStyle ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QWindowsStyle * ) ph )->~QWindowsStyle(); - ph = NULL; + ( ( QWindowsStyle * ) p->ph )->~QWindowsStyle(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsStyle Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWindowsStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWindowsStyle" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsStyle Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QWindowsStyle" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWindowsStyle" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsStyle Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWindowsStyle" ); + #endif } } +void * gcAllocate_QWindowsStyle( void * pObj ) +{ + QGC_POINTER_QWindowsStyle * p = ( QGC_POINTER_QWindowsStyle * ) hb_gcAllocate( sizeof( QGC_POINTER_QWindowsStyle ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWindowsStyle; + new( & p->pq ) QPointer< QWindowsStyle >( ( QWindowsStyle * ) pObj ); + #if defined(__debug__) + just_debug( " new_QWindowsStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWINDOWSSTYLE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QWindowsStyle > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWindowsStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = ( QWindowsStyle* ) new QWindowsStyle() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWindowsStyle; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWindowsStyle( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QWindowsXPStyle.cpp b/harbour/contrib/hbqt/qtgui/QWindowsXPStyle.cpp index 6401b9a5a0..bc3a033c81 100644 --- a/harbour/contrib/hbqt/qtgui/QWindowsXPStyle.cpp +++ b/harbour/contrib/hbqt/qtgui/QWindowsXPStyle.cpp @@ -77,42 +77,65 @@ * */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QWindowsXPStyle > pq; +} QGC_POINTER_QWindowsXPStyle; + QT_G_FUNC( release_QWindowsXPStyle ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWindowsXPStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QWindowsXPStyle * p = ( QGC_POINTER_QWindowsXPStyle * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsXPStyle p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsXPStyle ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QWindowsXPStyle * ) ph )->~QWindowsXPStyle(); - ph = NULL; + ( ( QWindowsXPStyle * ) p->ph )->~QWindowsXPStyle(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsXPStyle Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWindowsXPStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWindowsXPStyle" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsXPStyle Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QWindowsXPStyle" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWindowsXPStyle" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWindowsXPStyle Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWindowsXPStyle" ); + #endif } } +void * gcAllocate_QWindowsXPStyle( void * pObj ) +{ + QGC_POINTER_QWindowsXPStyle * p = ( QGC_POINTER_QWindowsXPStyle * ) hb_gcAllocate( sizeof( QGC_POINTER_QWindowsXPStyle ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWindowsXPStyle; + new( & p->pq ) QPointer< QWindowsXPStyle >( ( QWindowsXPStyle * ) pObj ); + #if defined(__debug__) + just_debug( " new_QWindowsXPStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWINDOWSXPSTYLE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QWindowsXPStyle > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWindowsXPStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; #if defined( HB_OS_WIN ) pObj = ( QWindowsXPStyle* ) new QWindowsXPStyle() ; @@ -120,13 +143,7 @@ hb_snprintf( str, sizeof(str), " GC: new QWindowsXPStyle %i B %i pObj = NULL ; #endif -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWindowsXPStyle; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWindowsXPStyle( pObj ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QWizard.cpp b/harbour/contrib/hbqt/qtgui/QWizard.cpp index 7a21a492a1..87f20ee517 100644 --- a/harbour/contrib/hbqt/qtgui/QWizard.cpp +++ b/harbour/contrib/hbqt/qtgui/QWizard.cpp @@ -96,52 +96,69 @@ * ~QWizard () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QWizard > pq; +} QGC_POINTER_QWizard; + QT_G_FUNC( release_QWizard ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWizard %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QWizard * p = ( QGC_POINTER_QWizard * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWizard p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QWizard ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QWizard * ) ph )->~QWizard(); - ph = NULL; + ( ( QWizard * ) p->ph )->~QWizard(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWizard Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWizard %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWizard" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWizard Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QWizard" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWizard" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWizard Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWizard" ); + #endif } } +void * gcAllocate_QWizard( void * pObj ) +{ + QGC_POINTER_QWizard * p = ( QGC_POINTER_QWizard * ) hb_gcAllocate( sizeof( QGC_POINTER_QWizard ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWizard; + new( & p->pq ) QPointer< QWizard >( ( QWizard * ) pObj ); + #if defined(__debug__) + just_debug( " new_QWizard %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWIZARD ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QWizard > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWizard %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QWizard( hbqt_par_QWidget( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWizard; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWizard( pObj ) ); } /* * int addPage ( QWizardPage * page ) @@ -188,7 +205,7 @@ HB_FUNC( QT_QWIZARD_CURRENTPAGE ) */ HB_FUNC( QT_QWIZARD_FIELD ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QWizard( 1 )->field( hbqt_par_QString( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QWizard( 1 )->field( hbqt_par_QString( 2 ) ) ) ) ); } /* @@ -228,7 +245,7 @@ HB_FUNC( QT_QWIZARD_PAGE ) */ HB_FUNC( QT_QWIZARD_PIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QWizard( 1 )->pixmap( ( QWizard::WizardPixmap ) hb_parni( 2 ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QWizard( 1 )->pixmap( ( QWizard::WizardPixmap ) hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWizardPage.cpp b/harbour/contrib/hbqt/qtgui/QWizardPage.cpp index 7665eb909a..b114174678 100644 --- a/harbour/contrib/hbqt/qtgui/QWizardPage.cpp +++ b/harbour/contrib/hbqt/qtgui/QWizardPage.cpp @@ -74,52 +74,69 @@ /* QWizardPage ( QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QWizardPage > pq; +} QGC_POINTER_QWizardPage; + QT_G_FUNC( release_QWizardPage ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWizardPage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QWizardPage * p = ( QGC_POINTER_QWizardPage * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWizardPage p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QWizardPage ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QWizardPage * ) ph )->~QWizardPage(); - ph = NULL; + ( ( QWizardPage * ) p->ph )->~QWizardPage(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWizardPage Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWizardPage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWizardPage" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWizardPage Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QWizardPage" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWizardPage" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWizardPage Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWizardPage" ); + #endif } } +void * gcAllocate_QWizardPage( void * pObj ) +{ + QGC_POINTER_QWizardPage * p = ( QGC_POINTER_QWizardPage * ) hb_gcAllocate( sizeof( QGC_POINTER_QWizardPage ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWizardPage; + new( & p->pq ) QPointer< QWizardPage >( ( QWizardPage * ) pObj ); + #if defined(__debug__) + just_debug( " new_QWizardPage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWIZARDPAGE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QWizardPage > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWizardPage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QWizardPage() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWizardPage; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWizardPage( pObj ) ); } /* * QString buttonText ( QWizard::WizardButton which ) const @@ -182,7 +199,7 @@ HB_FUNC( QT_QWIZARDPAGE_NEXTID ) */ HB_FUNC( QT_QWIZARDPAGE_PIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QWizardPage( 1 )->pixmap( ( QWizard::WizardPixmap ) hb_parni( 2 ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QWizardPage( 1 )->pixmap( ( QWizard::WizardPixmap ) hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qth/QAbstractItemModel.qth b/harbour/contrib/hbqt/qth/QAbstractItemModel.qth index 0fd4e2e440..095ea540e3 100644 --- a/harbour/contrib/hbqt/qth/QAbstractItemModel.qth +++ b/harbour/contrib/hbqt/qth/QAbstractItemModel.qth @@ -118,7 +118,8 @@ HB_FUNC( QT_HBDBFMODEL_RESET ) HB_FUNC( QT_HBDBFMODEL_INDEX ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_HbDbfModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), QModelIndex() ) ), release_QModelIndex ) ); +// BI hb_retptrGC( hbqt_ptrTOgcpointer( new QModelIndex( hbqt_par_HbDbfModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), QModelIndex() ) ), release_QModelIndex ) ); + hb_retptrGC( gcAllocate_QModelIndex( new QModelIndex( hbqt_par_HbDbfModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), QModelIndex() ) ) ) ); } HB_FUNC( QT_HBDBFMODEL_HBSETROWCOLUMNS ) @@ -128,6 +129,8 @@ HB_FUNC( QT_HBDBFMODEL_HBSETROWCOLUMNS ) HB_FUNC( QT_HBDBFMODEL_DESTROY ) { +// BI:TODO fix the GPF hbqt_par_HbDbfModel( 1 )->~HbDbfModel(); +// BUT WITHOUT THIS FM STATISTICS GENERATE A BIG LOG SO THIS IS NOT THE OPTION NOW hbqt_par_HbDbfModel( 1 )->~HbDbfModel(); } diff --git a/harbour/contrib/hbqt/qtnetwork/QFtp.cpp b/harbour/contrib/hbqt/qtnetwork/QFtp.cpp index cc0f79b6e3..b595b6ec77 100644 --- a/harbour/contrib/hbqt/qtnetwork/QFtp.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QFtp.cpp @@ -99,52 +99,69 @@ HB_FUNC( QT_QFTP_READ ) hb_xfree( iData ); } +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QFtp > pq; +} QGC_POINTER_QFtp; + QT_G_FUNC( release_QFtp ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QFtp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QFtp * p = ( QGC_POINTER_QFtp * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QFtp p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QFtp ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QFtp * ) ph )->~QFtp(); - ph = NULL; + ( ( QFtp * ) p->ph )->~QFtp(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QFtp Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QFtp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QFtp" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFtp Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QFtp" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QFtp" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QFtp Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QFtp" ); + #endif } } +void * gcAllocate_QFtp( void * pObj ) +{ + QGC_POINTER_QFtp * p = ( QGC_POINTER_QFtp * ) hb_gcAllocate( sizeof( QGC_POINTER_QFtp ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QFtp; + new( & p->pq ) QPointer< QFtp >( ( QFtp * ) pObj ); + #if defined(__debug__) + just_debug( " new_QFtp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QFTP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QFtp > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QFtp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QFtp( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QFtp; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QFtp( pObj ) ); } /* * qint64 bytesAvailable () const @@ -295,7 +312,7 @@ HB_FUNC( QT_QFTP_RAWCOMMAND ) */ HB_FUNC( QT_QFTP_READALL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QFtp( 1 )->readAll() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QFtp( 1 )->readAll() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtnetwork/QHttp.cpp b/harbour/contrib/hbqt/qtnetwork/QHttp.cpp index 95dc6d8c92..331b17f923 100644 --- a/harbour/contrib/hbqt/qtnetwork/QHttp.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QHttp.cpp @@ -99,52 +99,69 @@ HB_FUNC( QT_QHTTP_READ ) hb_xfree( iData ); } +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QHttp > pq; +} QGC_POINTER_QHttp; + QT_G_FUNC( release_QHttp ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QHttp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QHttp * p = ( QGC_POINTER_QHttp * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QHttp p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QHttp ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QHttp * ) ph )->~QHttp(); - ph = NULL; + ( ( QHttp * ) p->ph )->~QHttp(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QHttp Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QHttp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QHttp" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QHttp Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QHttp" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QHttp" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QHttp Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QHttp" ); + #endif } } +void * gcAllocate_QHttp( void * pObj ) +{ + QGC_POINTER_QHttp * p = ( QGC_POINTER_QHttp * ) hb_gcAllocate( sizeof( QGC_POINTER_QHttp ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QHttp; + new( & p->pq ) QPointer< QHttp >( ( QHttp * ) pObj ); + #if defined(__debug__) + just_debug( " new_QHttp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QHTTP ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QHttp > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QHttp %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QHttp( hbqt_par_QObject( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QHttp; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QHttp( pObj ) ); } /* * qint64 bytesAvailable () const @@ -191,7 +208,7 @@ HB_FUNC( QT_QHTTP_CURRENTID ) */ HB_FUNC( QT_QHTTP_CURRENTREQUEST ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QHttpRequestHeader( hbqt_par_QHttp( 1 )->currentRequest() ), release_QHttpRequestHeader ) ); + hb_retptrGC( gcAllocate_QHttpRequestHeader( new QHttpRequestHeader( hbqt_par_QHttp( 1 )->currentRequest() ) ) ); } /* @@ -247,7 +264,7 @@ HB_FUNC( QT_QHTTP_HEAD ) */ HB_FUNC( QT_QHTTP_LASTRESPONSE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QHttpResponseHeader( hbqt_par_QHttp( 1 )->lastResponse() ), release_QHttpResponseHeader ) ); + hb_retptrGC( gcAllocate_QHttpResponseHeader( new QHttpResponseHeader( hbqt_par_QHttp( 1 )->lastResponse() ) ) ); } /* @@ -271,7 +288,7 @@ HB_FUNC( QT_QHTTP_POST_1 ) */ HB_FUNC( QT_QHTTP_READALL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QHttp( 1 )->readAll() ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QHttp( 1 )->readAll() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp b/harbour/contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp index ed936012cd..0e9c131c51 100644 --- a/harbour/contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp @@ -79,40 +79,48 @@ QT_G_FUNC( release_QHttpRequestHeader ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QHttpRequestHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QHttpRequestHeader p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QHttpRequestHeader ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QHttpRequestHeader * ) ph )->~QHttpRequestHeader(); - ph = NULL; + ( ( QHttpRequestHeader * ) p->ph )->~QHttpRequestHeader(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QHttpRequestHeader Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QHttpRequestHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QHttpRequestHeader" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QHttpRequestHeader Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QHttpRequestHeader" ); + #endif } } +void * gcAllocate_QHttpRequestHeader( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QHttpRequestHeader; + #if defined(__debug__) + just_debug( " new_QHttpRequestHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QHTTPREQUESTHEADER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QHttpRequestHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QHttpRequestHeader() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QHttpRequestHeader; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QHttpRequestHeader( pObj ) ); } /* * virtual int majorVersion () const diff --git a/harbour/contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp b/harbour/contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp index 7d11a6ea8c..c11fac1a0a 100644 --- a/harbour/contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp @@ -79,40 +79,48 @@ QT_G_FUNC( release_QHttpResponseHeader ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QHttpResponseHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QHttpResponseHeader p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QHttpResponseHeader ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QHttpResponseHeader * ) ph )->~QHttpResponseHeader(); - ph = NULL; + ( ( QHttpResponseHeader * ) p->ph )->~QHttpResponseHeader(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QHttpResponseHeader Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QHttpResponseHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QHttpResponseHeader" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QHttpResponseHeader Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QHttpResponseHeader" ); + #endif } } +void * gcAllocate_QHttpResponseHeader( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QHttpResponseHeader; + #if defined(__debug__) + just_debug( " new_QHttpResponseHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QHTTPRESPONSEHEADER ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QHttpResponseHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QHttpResponseHeader() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QHttpResponseHeader; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QHttpResponseHeader( pObj ) ); } /* * virtual int majorVersion () const diff --git a/harbour/contrib/hbqt/qtnetwork/QNetworkRequest.cpp b/harbour/contrib/hbqt/qtnetwork/QNetworkRequest.cpp index f7f3283cd8..2378f6a075 100644 --- a/harbour/contrib/hbqt/qtnetwork/QNetworkRequest.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QNetworkRequest.cpp @@ -98,47 +98,55 @@ QT_G_FUNC( release_QNetworkRequest ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QNetworkRequest %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QNetworkRequest p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QNetworkRequest ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QNetworkRequest * ) ph )->~QNetworkRequest(); - ph = NULL; + ( ( QNetworkRequest * ) p->ph )->~QNetworkRequest(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QNetworkRequest Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QNetworkRequest %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QNetworkRequest" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QNetworkRequest Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QNetworkRequest" ); + #endif } } +void * gcAllocate_QNetworkRequest( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QNetworkRequest; + #if defined(__debug__) + just_debug( " new_QNetworkRequest %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QNETWORKREQUEST ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QNetworkRequest %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = new QNetworkRequest() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QNetworkRequest; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QNetworkRequest( pObj ) ); } /* * QVariant attribute ( Attribute code, const QVariant & defaultValue = QVariant() ) const */ HB_FUNC( QT_QNETWORKREQUEST_ATTRIBUTE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QNetworkRequest( 1 )->attribute( ( QNetworkRequest::Attribute ) hb_parni( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QVariant( 3 ) : QVariant() ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QNetworkRequest( 1 )->attribute( ( QNetworkRequest::Attribute ) hb_parni( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QVariant( 3 ) : QVariant() ) ) ) ) ); } /* @@ -154,7 +162,7 @@ HB_FUNC( QT_QNETWORKREQUEST_HASRAWHEADER ) */ HB_FUNC( QT_QNETWORKREQUEST_HEADER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QNetworkRequest( 1 )->header( ( QNetworkRequest::KnownHeaders ) hb_parni( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QNetworkRequest( 1 )->header( ( QNetworkRequest::KnownHeaders ) hb_parni( 2 ) ) ) ) ); } /* @@ -162,7 +170,7 @@ HB_FUNC( QT_QNETWORKREQUEST_HEADER ) */ HB_FUNC( QT_QNETWORKREQUEST_RAWHEADER ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QByteArray( hbqt_par_QNetworkRequest( 1 )->rawHeader( *hbqt_par_QByteArray( 2 ) ) ), release_QByteArray ) ); + hb_retptrGC( gcAllocate_QByteArray( new QByteArray( hbqt_par_QNetworkRequest( 1 )->rawHeader( *hbqt_par_QByteArray( 2 ) ) ) ) ); } /* @@ -202,7 +210,7 @@ HB_FUNC( QT_QNETWORKREQUEST_SETURL ) */ HB_FUNC( QT_QNETWORKREQUEST_URL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QNetworkRequest( 1 )->url() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QNetworkRequest( 1 )->url() ) ) ); } diff --git a/harbour/contrib/hbqt/qtwebkit/QWebFrame.cpp b/harbour/contrib/hbqt/qtwebkit/QWebFrame.cpp index 036a719872..086d4cf616 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebFrame.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebFrame.cpp @@ -118,7 +118,7 @@ HB_FUNC( QT_QWEBFRAME_ADDTOJAVASCRIPTWINDOWOBJECT_1 ) */ HB_FUNC( QT_QWEBFRAME_CONTENTSSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWebFrame( 1 )->contentsSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWebFrame( 1 )->contentsSize() ) ) ); } /* @@ -134,7 +134,7 @@ HB_FUNC( QT_QWEBFRAME_FRAMENAME ) */ HB_FUNC( QT_QWEBFRAME_GEOMETRY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QWebFrame( 1 )->geometry() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QWebFrame( 1 )->geometry() ) ) ); } /* @@ -142,7 +142,7 @@ HB_FUNC( QT_QWEBFRAME_GEOMETRY ) */ HB_FUNC( QT_QWEBFRAME_HITTESTCONTENT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QWebHitTestResult( hbqt_par_QWebFrame( 1 )->hitTestContent( *hbqt_par_QPoint( 2 ) ) ), release_QWebHitTestResult ) ); + hb_retptrGC( gcAllocate_QWebHitTestResult( new QWebHitTestResult( hbqt_par_QWebFrame( 1 )->hitTestContent( *hbqt_par_QPoint( 2 ) ) ) ) ); } /* @@ -150,7 +150,7 @@ HB_FUNC( QT_QWEBFRAME_HITTESTCONTENT ) */ HB_FUNC( QT_QWEBFRAME_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QWebFrame( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QWebFrame( 1 )->icon() ) ) ); } /* @@ -182,7 +182,7 @@ HB_FUNC( QT_QWEBFRAME_PARENTFRAME ) */ HB_FUNC( QT_QWEBFRAME_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWebFrame( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWebFrame( 1 )->pos() ) ) ); } /* @@ -254,7 +254,7 @@ HB_FUNC( QT_QWEBFRAME_SCROLLBARVALUE ) */ HB_FUNC( QT_QWEBFRAME_SCROLLPOSITION ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWebFrame( 1 )->scrollPosition() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWebFrame( 1 )->scrollPosition() ) ) ); } /* @@ -262,7 +262,7 @@ HB_FUNC( QT_QWEBFRAME_SCROLLPOSITION ) */ HB_FUNC( QT_QWEBFRAME_SECURITYORIGIN ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QWebSecurityOrigin( hbqt_par_QWebFrame( 1 )->securityOrigin() ), release_QWebSecurityOrigin ) ); + hb_retptrGC( gcAllocate_QWebSecurityOrigin( new QWebSecurityOrigin( hbqt_par_QWebFrame( 1 )->securityOrigin() ) ) ); } /* @@ -366,7 +366,7 @@ HB_FUNC( QT_QWEBFRAME_TOPLAINTEXT ) */ HB_FUNC( QT_QWEBFRAME_URL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QWebFrame( 1 )->url() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QWebFrame( 1 )->url() ) ) ); } /* @@ -382,7 +382,7 @@ HB_FUNC( QT_QWEBFRAME_ZOOMFACTOR ) */ HB_FUNC( QT_QWEBFRAME_EVALUATEJAVASCRIPT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QWebFrame( 1 )->evaluateJavaScript( hbqt_par_QString( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QWebFrame( 1 )->evaluateJavaScript( hbqt_par_QString( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtwebkit/QWebHistory.cpp b/harbour/contrib/hbqt/qtwebkit/QWebHistory.cpp index c75ac5e340..005dbf6620 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebHistory.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebHistory.cpp @@ -107,7 +107,7 @@ HB_FUNC( QT_QWEBHISTORY_BACK ) */ HB_FUNC( QT_QWEBHISTORY_BACKITEM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QWebHistoryItem( hbqt_par_QWebHistory( 1 )->backItem() ), release_QWebHistoryItem ) ); + hb_retptrGC( gcAllocate_QWebHistoryItem( new QWebHistoryItem( hbqt_par_QWebHistory( 1 )->backItem() ) ) ); } /* @@ -147,7 +147,7 @@ HB_FUNC( QT_QWEBHISTORY_COUNT ) */ HB_FUNC( QT_QWEBHISTORY_CURRENTITEM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QWebHistoryItem( hbqt_par_QWebHistory( 1 )->currentItem() ), release_QWebHistoryItem ) ); + hb_retptrGC( gcAllocate_QWebHistoryItem( new QWebHistoryItem( hbqt_par_QWebHistory( 1 )->currentItem() ) ) ); } /* @@ -171,7 +171,7 @@ HB_FUNC( QT_QWEBHISTORY_FORWARD ) */ HB_FUNC( QT_QWEBHISTORY_FORWARDITEM ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QWebHistoryItem( hbqt_par_QWebHistory( 1 )->forwardItem() ), release_QWebHistoryItem ) ); + hb_retptrGC( gcAllocate_QWebHistoryItem( new QWebHistoryItem( hbqt_par_QWebHistory( 1 )->forwardItem() ) ) ); } /* @@ -187,7 +187,7 @@ HB_FUNC( QT_QWEBHISTORY_GOTOITEM ) */ HB_FUNC( QT_QWEBHISTORY_ITEMAT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QWebHistoryItem( hbqt_par_QWebHistory( 1 )->itemAt( hb_parni( 2 ) ) ), release_QWebHistoryItem ) ); + hb_retptrGC( gcAllocate_QWebHistoryItem( new QWebHistoryItem( hbqt_par_QWebHistory( 1 )->itemAt( hb_parni( 2 ) ) ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtwebkit/QWebHistoryInterface.cpp b/harbour/contrib/hbqt/qtwebkit/QWebHistoryInterface.cpp index 31f9ef0f8b..6d6642142c 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebHistoryInterface.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebHistoryInterface.cpp @@ -78,31 +78,7 @@ QT_G_FUNC( release_QWebHistoryInterface ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWebHistoryInterface %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QWebHistoryInterface * ) ph )->~QWebHistoryInterface(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWebHistoryInterface" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWebHistoryInterface" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QWEBHISTORYINTERFACE ) diff --git a/harbour/contrib/hbqt/qtwebkit/QWebHistoryItem.cpp b/harbour/contrib/hbqt/qtwebkit/QWebHistoryItem.cpp index da86d7e851..54752fe68e 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebHistoryItem.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebHistoryItem.cpp @@ -80,50 +80,58 @@ QT_G_FUNC( release_QWebHistoryItem ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWebHistoryItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWebHistoryItem p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QWebHistoryItem ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QWebHistoryItem * ) ph )->~QWebHistoryItem(); - ph = NULL; + ( ( QWebHistoryItem * ) p->ph )->~QWebHistoryItem(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWebHistoryItem Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWebHistoryItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWebHistoryItem" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWebHistoryItem Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWebHistoryItem" ); + #endif } } +void * gcAllocate_QWebHistoryItem( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWebHistoryItem; + #if defined(__debug__) + just_debug( " new_QWebHistoryItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWEBHISTORYITEM ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWebHistoryItem %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { pObj = new QWebHistoryItem( *hbqt_par_QWebHistoryItem( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWebHistoryItem; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWebHistoryItem( pObj ) ); } /* * QIcon icon () const */ HB_FUNC( QT_QWEBHISTORYITEM_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QWebHistoryItem( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QWebHistoryItem( 1 )->icon() ) ) ); } /* @@ -139,7 +147,7 @@ HB_FUNC( QT_QWEBHISTORYITEM_ISVALID ) */ HB_FUNC( QT_QWEBHISTORYITEM_LASTVISITED ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QDateTime( hbqt_par_QWebHistoryItem( 1 )->lastVisited() ), release_QDateTime ) ); + hb_retptrGC( gcAllocate_QDateTime( new QDateTime( hbqt_par_QWebHistoryItem( 1 )->lastVisited() ) ) ); } /* @@ -147,7 +155,7 @@ HB_FUNC( QT_QWEBHISTORYITEM_LASTVISITED ) */ HB_FUNC( QT_QWEBHISTORYITEM_ORIGINALURL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QWebHistoryItem( 1 )->originalUrl() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QWebHistoryItem( 1 )->originalUrl() ) ) ); } /* @@ -171,7 +179,7 @@ HB_FUNC( QT_QWEBHISTORYITEM_TITLE ) */ HB_FUNC( QT_QWEBHISTORYITEM_URL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QWebHistoryItem( 1 )->url() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QWebHistoryItem( 1 )->url() ) ) ); } /* @@ -179,7 +187,7 @@ HB_FUNC( QT_QWEBHISTORYITEM_URL ) */ HB_FUNC( QT_QWEBHISTORYITEM_USERDATA ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QWebHistoryItem( 1 )->userData() ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QWebHistoryItem( 1 )->userData() ) ) ); } diff --git a/harbour/contrib/hbqt/qtwebkit/QWebHitTestResult.cpp b/harbour/contrib/hbqt/qtwebkit/QWebHitTestResult.cpp index e9a3ca27dc..0ada4e998d 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebHitTestResult.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebHitTestResult.cpp @@ -79,40 +79,48 @@ QT_G_FUNC( release_QWebHitTestResult ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWebHitTestResult %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWebHitTestResult p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QWebHitTestResult ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QWebHitTestResult * ) ph )->~QWebHitTestResult(); - ph = NULL; + ( ( QWebHitTestResult * ) p->ph )->~QWebHitTestResult(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWebHitTestResult Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWebHitTestResult %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWebHitTestResult" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWebHitTestResult Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWebHitTestResult" ); + #endif } } +void * gcAllocate_QWebHitTestResult( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWebHitTestResult; + #if defined(__debug__) + just_debug( " new_QWebHitTestResult %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWEBHITTESTRESULT ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWebHitTestResult %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif pObj = ( QWebHitTestResult* ) new QWebHitTestResult() ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWebHitTestResult; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWebHitTestResult( pObj ) ); } /* * QString alternateText () const @@ -127,7 +135,7 @@ HB_FUNC( QT_QWEBHITTESTRESULT_ALTERNATETEXT ) */ HB_FUNC( QT_QWEBHITTESTRESULT_BOUNDINGRECT ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QRect( hbqt_par_QWebHitTestResult( 1 )->boundingRect() ), release_QRect ) ); + hb_retptrGC( gcAllocate_QRect( new QRect( hbqt_par_QWebHitTestResult( 1 )->boundingRect() ) ) ); } /* @@ -143,7 +151,7 @@ HB_FUNC( QT_QWEBHITTESTRESULT_FRAME ) */ HB_FUNC( QT_QWEBHITTESTRESULT_IMAGEURL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QWebHitTestResult( 1 )->imageUrl() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QWebHitTestResult( 1 )->imageUrl() ) ) ); } /* @@ -191,7 +199,7 @@ HB_FUNC( QT_QWEBHITTESTRESULT_LINKTEXT ) */ HB_FUNC( QT_QWEBHITTESTRESULT_LINKTITLE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QWebHitTestResult( 1 )->linkTitle() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QWebHitTestResult( 1 )->linkTitle() ) ) ); } /* @@ -199,7 +207,7 @@ HB_FUNC( QT_QWEBHITTESTRESULT_LINKTITLE ) */ HB_FUNC( QT_QWEBHITTESTRESULT_LINKURL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QWebHitTestResult( 1 )->linkUrl() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QWebHitTestResult( 1 )->linkUrl() ) ) ); } /* @@ -207,7 +215,7 @@ HB_FUNC( QT_QWEBHITTESTRESULT_LINKURL ) */ HB_FUNC( QT_QWEBHITTESTRESULT_PIXMAP ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QWebHitTestResult( 1 )->pixmap() ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QWebHitTestResult( 1 )->pixmap() ) ) ); } /* @@ -215,7 +223,7 @@ HB_FUNC( QT_QWEBHITTESTRESULT_PIXMAP ) */ HB_FUNC( QT_QWEBHITTESTRESULT_POS ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPoint( hbqt_par_QWebHitTestResult( 1 )->pos() ), release_QPoint ) ); + hb_retptrGC( gcAllocate_QPoint( new QPoint( hbqt_par_QWebHitTestResult( 1 )->pos() ) ) ); } /* diff --git a/harbour/contrib/hbqt/qtwebkit/QWebPage.cpp b/harbour/contrib/hbqt/qtwebkit/QWebPage.cpp index 6ced116b5c..69c05f3a5b 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebPage.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebPage.cpp @@ -87,52 +87,69 @@ * ~QWebPage () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QWebPage > pq; +} QGC_POINTER_QWebPage; + QT_G_FUNC( release_QWebPage ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWebPage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QWebPage * p = ( QGC_POINTER_QWebPage * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWebPage p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QWebPage ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QWebPage * ) ph )->~QWebPage(); - ph = NULL; + ( ( QWebPage * ) p->ph )->~QWebPage(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWebPage Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWebPage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWebPage" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWebPage Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QWebPage" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWebPage" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWebPage Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWebPage" ); + #endif } } +void * gcAllocate_QWebPage( void * pObj ) +{ + QGC_POINTER_QWebPage * p = ( QGC_POINTER_QWebPage * ) hb_gcAllocate( sizeof( QGC_POINTER_QWebPage ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWebPage; + new( & p->pq ) QPointer< QWebPage >( ( QWebPage * ) pObj ); + #if defined(__debug__) + just_debug( " new_QWebPage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWEBPAGE ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QWebPage > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWebPage %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QWebPage( hbqt_par_QWidget( 2 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWebPage; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWebPage( pObj ) ); } /* * QAction * action ( WebAction action ) const @@ -203,7 +220,7 @@ HB_FUNC( QT_QWEBPAGE_HISTORY ) */ HB_FUNC( QT_QWEBPAGE_INPUTMETHODQUERY ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QVariant( hbqt_par_QWebPage( 1 )->inputMethodQuery( ( Qt::InputMethodQuery ) hb_parni( 2 ) ) ), release_QVariant ) ); + hb_retptrGC( gcAllocate_QVariant( new QVariant( hbqt_par_QWebPage( 1 )->inputMethodQuery( ( Qt::InputMethodQuery ) hb_parni( 2 ) ) ) ) ); } /* @@ -243,7 +260,7 @@ HB_FUNC( QT_QWEBPAGE_MAINFRAME ) */ HB_FUNC( QT_QWEBPAGE_PALETTE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPalette( hbqt_par_QWebPage( 1 )->palette() ), release_QPalette ) ); + hb_retptrGC( gcAllocate_QPalette( new QPalette( hbqt_par_QWebPage( 1 )->palette() ) ) ); } /* @@ -387,7 +404,7 @@ HB_FUNC( QT_QWEBPAGE_VIEW ) */ HB_FUNC( QT_QWEBPAGE_VIEWPORTSIZE ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QSize( hbqt_par_QWebPage( 1 )->viewportSize() ), release_QSize ) ); + hb_retptrGC( gcAllocate_QSize( new QSize( hbqt_par_QWebPage( 1 )->viewportSize() ) ) ); } diff --git a/harbour/contrib/hbqt/qtwebkit/QWebPluginFactory.cpp b/harbour/contrib/hbqt/qtwebkit/QWebPluginFactory.cpp index c48e7824f7..9e1f1deca3 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebPluginFactory.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebPluginFactory.cpp @@ -96,31 +96,7 @@ QT_G_FUNC( release_QWebPluginFactory ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWebPluginFactory %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) - { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) - { - ( ( QWebPluginFactory * ) ph )->~QWebPluginFactory(); - ph = NULL; - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWebPluginFactory" ); OutputDebugString( str ); -#endif - } - } - else - { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWebPluginFactory" ); OutputDebugString( str ); -#endif - } + HB_SYMBOL_UNUSED( Cargo ); } HB_FUNC( QT_QWEBPLUGINFACTORY ) diff --git a/harbour/contrib/hbqt/qtwebkit/QWebSecurityOrigin.cpp b/harbour/contrib/hbqt/qtwebkit/QWebSecurityOrigin.cpp index 8ddaf6f283..ee3d1e16ab 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebSecurityOrigin.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebSecurityOrigin.cpp @@ -88,43 +88,51 @@ QT_G_FUNC( release_QWebSecurityOrigin ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWebSecurityOrigin %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWebSecurityOrigin p=%p", p ) ); + HB_TRACE( HB_TR_DEBUG, ( "release_QWebSecurityOrigin ph=%p", p->ph ) ); + + if( p && p->ph ) { - ( ( QWebSecurityOrigin * ) ph )->~QWebSecurityOrigin(); - ph = NULL; + ( ( QWebSecurityOrigin * ) p->ph )->~QWebSecurityOrigin(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWebSecurityOrigin Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWebSecurityOrigin %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWebSecurityOrigin" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWebSecurityOrigin Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWebSecurityOrigin" ); + #endif } } +void * gcAllocate_QWebSecurityOrigin( void * pObj ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWebSecurityOrigin; + #if defined(__debug__) + just_debug( " new_QWebSecurityOrigin %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWEBSECURITYORIGIN ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); void * pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWebSecurityOrigin %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) { pObj = new QWebSecurityOrigin( *hbqt_par_QWebSecurityOrigin( 1 ) ) ; } -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWebSecurityOrigin; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWebSecurityOrigin( pObj ) ); } /* * qint64 databaseQuota () const diff --git a/harbour/contrib/hbqt/qtwebkit/QWebSettings.cpp b/harbour/contrib/hbqt/qtwebkit/QWebSettings.cpp index 7e3a74cc3d..76fa87c397 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebSettings.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebSettings.cpp @@ -176,7 +176,7 @@ HB_FUNC( QT_QWEBSETTINGS_TESTATTRIBUTE ) */ HB_FUNC( QT_QWEBSETTINGS_USERSTYLESHEETURL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QWebSettings( 1 )->userStyleSheetUrl() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QWebSettings( 1 )->userStyleSheetUrl() ) ) ); } /* @@ -208,7 +208,7 @@ HB_FUNC( QT_QWEBSETTINGS_ICONDATABASEPATH ) */ HB_FUNC( QT_QWEBSETTINGS_ICONFORURL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QWebSettings( 1 )->iconForUrl( *hbqt_par_QUrl( 2 ) ) ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QWebSettings( 1 )->iconForUrl( *hbqt_par_QUrl( 2 ) ) ) ) ); } /* @@ -288,7 +288,7 @@ HB_FUNC( QT_QWEBSETTINGS_SETWEBGRAPHIC ) */ HB_FUNC( QT_QWEBSETTINGS_WEBGRAPHIC ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QPixmap( hbqt_par_QWebSettings( 1 )->webGraphic( ( QWebSettings::WebGraphic ) hb_parni( 2 ) ) ), release_QPixmap ) ); + hb_retptrGC( gcAllocate_QPixmap( new QPixmap( hbqt_par_QWebSettings( 1 )->webGraphic( ( QWebSettings::WebGraphic ) hb_parni( 2 ) ) ) ) ); } diff --git a/harbour/contrib/hbqt/qtwebkit/QWebView.cpp b/harbour/contrib/hbqt/qtwebkit/QWebView.cpp index 44cb3cdfce..975ba08d38 100644 --- a/harbour/contrib/hbqt/qtwebkit/QWebView.cpp +++ b/harbour/contrib/hbqt/qtwebkit/QWebView.cpp @@ -77,52 +77,69 @@ * virtual ~QWebView () */ +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QWebView > pq; +} QGC_POINTER_QWebView; + QT_G_FUNC( release_QWebView ) { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "release_QWebView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - void * ph = ( void * ) Cargo; - if( ph ) + QGC_POINTER_QWebView * p = ( QGC_POINTER_QWebView * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "release_QWebView p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "release_QWebView ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - const QMetaObject * m = ( ( QObject * ) ph )->metaObject(); + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - ( ( QWebView * ) ph )->~QWebView(); - ph = NULL; + ( ( QWebView * ) p->ph )->~QWebView(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QWebView Object deleted!" ) ); + #if defined(__debug__) + just_debug( " YES release_QWebView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " Object Name Missing: QWebView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWebView Object Name Missing!" ) ); + #if defined(__debug__) + just_debug( " NO release_QWebView" ); + #endif } } else { -#if defined(__debug__) -hb_snprintf( str, sizeof(str), "! ph____QWebView" ); OutputDebugString( str ); -#endif + HB_TRACE( HB_TR_DEBUG, ( "release_QWebView Object Allready deleted!" ) ); + #if defined(__debug__) + just_debug( " DEL release_QWebView" ); + #endif } } +void * gcAllocate_QWebView( void * pObj ) +{ + QGC_POINTER_QWebView * p = ( QGC_POINTER_QWebView * ) hb_gcAllocate( sizeof( QGC_POINTER_QWebView ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QWebView; + new( & p->pq ) QPointer< QWebView >( ( QWebView * ) pObj ); + #if defined(__debug__) + just_debug( " new_QWebView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); + #endif + return( p ); +} + HB_FUNC( QT_QWEBVIEW ) { - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); - QPointer< QWebView > pObj = NULL; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: new QWebView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif + void * pObj = NULL; pObj = new QWebView( hbqt_par_QWidget( 1 ) ) ; -#if defined(__debug__) -hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); -#endif - p->ph = pObj; - p->func = release_QWebView; - - hb_retptrGC( p ); + hb_retptrGC( gcAllocate_QWebView( pObj ) ); } /* * bool findText ( const QString & subString, QWebPage::FindFlags options = 0 ) @@ -145,7 +162,7 @@ HB_FUNC( QT_QWEBVIEW_HISTORY ) */ HB_FUNC( QT_QWEBVIEW_ICON ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QIcon( hbqt_par_QWebView( 1 )->icon() ), release_QIcon ) ); + hb_retptrGC( gcAllocate_QIcon( new QIcon( hbqt_par_QWebView( 1 )->icon() ) ) ); } /* @@ -281,7 +298,7 @@ HB_FUNC( QT_QWEBVIEW_TRIGGERPAGEACTION ) */ HB_FUNC( QT_QWEBVIEW_URL ) { - hb_retptrGC( hbqt_ptrTOgcpointer( new QUrl( hbqt_par_QWebView( 1 )->url() ), release_QUrl ) ); + hb_retptrGC( gcAllocate_QUrl( new QUrl( hbqt_par_QWebView( 1 )->url() ) ) ); } /* diff --git a/harbour/contrib/hbxbp/tests/demoxbp.prg b/harbour/contrib/hbxbp/tests/demoxbp.prg index 7cf20fb125..866bf3a002 100644 --- a/harbour/contrib/hbxbp/tests/demoxbp.prg +++ b/harbour/contrib/hbxbp/tests/demoxbp.prg @@ -101,7 +101,7 @@ PROCEDURE Main() FUNCTION _BuildADialog() -// hb_gtReload( 'GUI' ) + hb_gtReload( 'GUI' ) BuildADialog() RETURN NIL diff --git a/harbour/contrib/hbxbp/xbpbrowse.prg b/harbour/contrib/hbxbp/xbpbrowse.prg index 5cde180344..2ad532e309 100644 --- a/harbour/contrib/hbxbp/xbpbrowse.prg +++ b/harbour/contrib/hbxbp/xbpbrowse.prg @@ -629,11 +629,6 @@ METHOD XbpBrowse:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oDbfModel := HbDbfModel():new( {|p1,p2,p3,p4| ::supplyInfo( 141, p1, p2, p3, p4 ) } ) /* Attach Model with the View */ ::oTableView:setModel( QT_PTROF( ::oDbfModel ) ) - /* Set Initial Column and Row */ - #if 0 - ::oTableView:setCurrentIndex( QModelIndex():new():sibling( 0,0 ) ) - ::pCurIndex := ::oTableView:currentIndex() - #endif /* Horizontal Footer */ ::oFooterView := QHeaderView():new( Qt_Horizontal ) @@ -1285,7 +1280,6 @@ METHOD setCurrentIndex( lReset ) CLASS XbpBrowse ::oTableView:setCurrentIndex( pIndex ) //xbp_DEbug( " setCurrentIndex ", 1, lReset, memory( 1001 ) ) - RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index 994745ca3c..2ab2bb7c40 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -76,6 +76,7 @@ /*----------------------------------------------------------------------*/ #define EVENT_BUFFER 200 +#define CRLF chr( 13 )+chr( 10 ) /*----------------------------------------------------------------------*/ @@ -116,11 +117,15 @@ EXIT PROCEDURE Qt_End() oDummy := NIL oAppWindow := NIL - oDeskTop:oWidget:pPtr := 0 + + IF hb_isObject( oDeskTop ) + oDeskTop:oWidget:pPtr := 0 + endif oApp:quit() + #if 0 oApp:oWidget:pPtr := 0 - + #endif RETURN /*----------------------------------------------------------------------*/ @@ -170,9 +175,9 @@ FUNCTION SetAppEvent( nEvent, mp1, mp2, oXbp ) IF ++nEventIn > EVENT_BUFFER nEventIn := 1 ENDIF -#if 0 -xbp_debug( 0, "SetAppEvent ... ", threadID(), nEvent, xbeP_Paint ) -#endif + +//xbp_debug( 0, "SetAppEvent ... ", threadID(), nEvent, xbeP_Paint ) + ts_events[ nEventIn,1 ] := nEvent ts_events[ nEventIn,2 ] := mp1 ts_events[ nEventIn,3 ] := mp2 @@ -268,7 +273,7 @@ FUNCTION MsgBox( cMsg, cTitle ) oMB:setParent( SetAppWindow():pWidget ) oMB:setWindowFlags( Qt_Dialog ) oMB:setWindowTitle( cTitle ) - //SetAppWindow():oWidget:setFocus() + oMB:exec() RETURN nil @@ -291,16 +296,15 @@ FUNCTION GraMakeRGBColor( aRGB ) RETURN nRGB /*----------------------------------------------------------------------*/ - -#define CRLF chr( 13 )+chr( 10 ) - +// #define __debug__ FUNCTION Xbp_Debug( ... ) + #ifdef __debug__ LOCAL s := "" LOCAL aP := hb_aParams() aeval( aP, {|e| s += Xbp_XtoS( e ) + ' ' } ) hb_ToOutDebug( s ) - + #endif RETURN nil /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index 97748e4713..53fe2e39dc 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -721,6 +721,7 @@ METHOD XbpWindow:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible METHOD XbpWindow:destroy() LOCAL cXbp := __ObjGetClsName( self ) +//#define __debug__ #ifdef __debug__ xbp_Debug( ". " ) xbp_Debug( ThreadID(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hb_getMemUsed() ) @@ -730,6 +731,7 @@ xbp_Debug( ThreadID(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::ca SetEventLoop( NIL ) ::oEventLoop:exit( 0 ) ::oEventLoop:pPtr := 0 + //::oWidget:removeEventFilter( SetEventFilter() ) SetAppWindow( XbpObject():new() )