From f78ca011e76a0d8ea8c3ba7f0b748e6554d48ee6 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 10 Dec 2009 22:23:10 +0000 Subject: [PATCH] 2009-12-10 23:22 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qth/QAbstractItemModel.qth * contrib/hbqt/qth/QTableView.qth * contrib/hbqt/hbqt_events.cpp * contrib/hbqt/hbqt_slots.cpp * contrib/hbqt/hbqt_hbqmainwindow.cpp + Added TOFIX (also one QUESTION) to these code parts. All of them are potential leak or GPF generator issues. Could someone take a look at these? * contrib/hbqt/Makefile - contrib/hbqt/hbqt_hbdrawingarea.h - contrib/hbqt/hbqt_hbdrawingarea.cpp - Deleted unused custom class. * contrib/hbqt/qtgui/QTableView.cpp * contrib/hbqt/qtcore/QAbstractItemModel.cpp * Regenerated. --- harbour/ChangeLog | 19 ++++ harbour/contrib/hbqt/Makefile | 2 - harbour/contrib/hbqt/hbqt_events.cpp | 5 +- harbour/contrib/hbqt/hbqt_hbdrawingarea.cpp | 96 ------------------- harbour/contrib/hbqt/hbqt_hbdrawingarea.h | 80 ---------------- harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp | 1 + harbour/contrib/hbqt/hbqt_slots.cpp | 3 + .../hbqt/qtcore/QAbstractItemModel.cpp | 1 + harbour/contrib/hbqt/qtgui/QTableView.cpp | 1 + .../contrib/hbqt/qth/QAbstractItemModel.qth | 1 + harbour/contrib/hbqt/qth/QTableView.qth | 1 + 11 files changed, 31 insertions(+), 179 deletions(-) delete mode 100644 harbour/contrib/hbqt/hbqt_hbdrawingarea.cpp delete mode 100644 harbour/contrib/hbqt/hbqt_hbdrawingarea.h diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5dbb820b62..48445e94b3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,25 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-10 23:22 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qth/QAbstractItemModel.qth + * contrib/hbqt/qth/QTableView.qth + * contrib/hbqt/hbqt_events.cpp + * contrib/hbqt/hbqt_slots.cpp + * contrib/hbqt/hbqt_hbqmainwindow.cpp + + Added TOFIX (also one QUESTION) to these code parts. + All of them are potential leak or GPF generator issues. + Could someone take a look at these? + + * contrib/hbqt/Makefile + - contrib/hbqt/hbqt_hbdrawingarea.h + - contrib/hbqt/hbqt_hbdrawingarea.cpp + - Deleted unused custom class. + + * contrib/hbqt/qtgui/QTableView.cpp + * contrib/hbqt/qtcore/QAbstractItemModel.cpp + * Regenerated. + 2009-12-10 22:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/hbqt_events.cpp * contrib/hbqt/hbqt_slots.cpp diff --git a/harbour/contrib/hbqt/Makefile b/harbour/contrib/hbqt/Makefile index 4eeb505f5c..9b4e199d4d 100644 --- a/harbour/contrib/hbqt/Makefile +++ b/harbour/contrib/hbqt/Makefile @@ -18,7 +18,6 @@ ifneq ($(HB_HAS_QT),) MOC_HEADERS := \ hbqt_events.h \ hbqt_hbdbfmodel.h \ - hbqt_hbdrawingarea.h \ hbqt_hbqmainwindow.h \ hbqt_hbqsyntaxhighlighter.h \ hbqt_hbqtableview.h \ @@ -31,7 +30,6 @@ ifneq ($(HB_HAS_QT),) hbqt_destruct.cpp \ hbqt_events.cpp \ hbqt_hbdbfmodel.cpp \ - hbqt_hbdrawingarea.cpp \ hbqt_hbqmainwindow.cpp \ hbqt_hbqsyntaxhighlighter.cpp \ hbqt_hbqtableview.cpp \ diff --git a/harbour/contrib/hbqt/hbqt_events.cpp b/harbour/contrib/hbqt/hbqt_events.cpp index 195c9be8ee..e7fe820155 100644 --- a/harbour/contrib/hbqt/hbqt_events.cpp +++ b/harbour/contrib/hbqt/hbqt_events.cpp @@ -89,11 +89,13 @@ static Events * qt_getEventFilter( void ) return p_events->t_events; } +/* TOFIX: Possible GPF is below pointer is used by .prg after release. */ HB_FUNC( QT_GETEVENTFILTER ) { hb_retptr( qt_getEventFilter() ); } +/* TOFIX: Leak if .prg code doesn't call this explicitly. */ HB_FUNC( QT_EVENTS_DESTROY ) { PHB_EVENTS p_events = HB_QTTHREAD_EVENTS(); @@ -113,6 +115,7 @@ Events::Events( QObject * parent ) : QObject( parent ) Events::~Events() { + /* TOFIX: Possible leak of PHB_ITEMs stored in list. */ listBlock.clear(); } @@ -123,7 +126,7 @@ bool Events::eventFilter( QObject * object, QEvent * event ) if( ( int ) eventtype == 0 ) return false; - char prop[ 10 ]; + char prop[ 20 ]; hb_snprintf( prop, sizeof( prop ), "%s%i%s", "P", eventtype, "P" ); int found = object->property( prop ).toInt(); diff --git a/harbour/contrib/hbqt/hbqt_hbdrawingarea.cpp b/harbour/contrib/hbqt/hbqt_hbdrawingarea.cpp deleted file mode 100644 index 26f570b5e4..0000000000 --- a/harbour/contrib/hbqt/hbqt_hbdrawingarea.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * QT wrapper main header - * - * Copyright 2009 Marcos Antonio Gambeta - * - * Copyright 2009 Pritpal Bedi - * www - http://www.harbour-project.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - */ -/*----------------------------------------------------------------------*/ - -#include "hbapi.h" - -#include "hbqt.h" - -#if QT_VERSION >= 0x040500 - -#include "hbqt_hbdrawingarea.h" - -HBDrawingArea::HBDrawingArea(QWidget *parent) : QWidget(parent) -{ - setAttribute( Qt::WA_StaticContents ); - setAttribute( Qt::WA_PaintOnScreen ); - setAttribute( Qt::WA_DeleteOnClose ); - setAttribute( Qt::WA_WindowPropagation ); - - setFocusPolicy( Qt::StrongFocus ); - setMouseTracking( true ); - - setAttribute( Qt::WA_InputMethodEnabled, true ); -} - -HBDrawingArea::~HBDrawingArea( void ) -{ -} - -void HBDrawingArea::mouseMoveEvent( QMouseEvent * event ) -{ - emit sg_mouseMoveEvent( event ); -} - -void HBDrawingArea::keyPressEvent( QKeyEvent * event ) -{ - emit sg_keyPressEvent( event ); -} - -HB_FUNC( QT_HBDRAWINGAREA ) -{ - hb_retptr( ( HBDrawingArea * ) new HBDrawingArea() ); -} - -#endif diff --git a/harbour/contrib/hbqt/hbqt_hbdrawingarea.h b/harbour/contrib/hbqt/hbqt_hbdrawingarea.h deleted file mode 100644 index ad9dd0ad6d..0000000000 --- a/harbour/contrib/hbqt/hbqt_hbdrawingarea.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * QT wrapper main header - * - * Copyright 2009 Marcos Antonio Gambeta - * - * Copyright 2009 Pritpal Bedi - * www - http://www.harbour-project.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - */ - -#ifndef HBQT_HBDRAWINGAREA_H -#define HBQT_HBDRAWINGAREA_H - -/*----------------------------------------------------------------------*/ - -#include - -class HBDrawingArea : public QWidget -{ - Q_OBJECT - -public: - HBDrawingArea( QWidget *parent = 0 ); - virtual ~HBDrawingArea( void ); - - void keyPressEvent( QKeyEvent * event ); - void mouseMoveEvent( QMouseEvent * event ); - -signals: - void sg_mouseMoveEvent( QMouseEvent * event ); - void sg_keyPressEvent( QKeyEvent * event ); -}; - -/*----------------------------------------------------------------------*/ - -#endif diff --git a/harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp b/harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp index 73a54ccd92..697dba022c 100644 --- a/harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp @@ -289,6 +289,7 @@ HB_FUNC( QT_HBQMAINWINDOW ) hb_retptr( ( HBQMainWindow * ) new HBQMainWindow( hb_itemNew( hb_param( 1, HB_IT_BLOCK ) ), hb_parni( 2 ) ) ); } +/* TOFIX: Leak if .prg code doesn't call this explicitly. */ HB_FUNC( QT_HBQMAINWINDOW_DESTROY ) { hbqt_par_HBQMainWindow( 1 )->~HBQMainWindow(); diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index cd726a789d..87e226ae87 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -87,6 +87,8 @@ static Slots * qt_getEventSlots( void ) return p_slots->t_slots; } +/* TOFIX: Leak if .prg code doesn't call this explicitly. + QUESTION: Should there be all remaining active slots disconnected at this point? */ HB_FUNC( QT_SLOTS_DESTROY ) { PHB_SLOTS p_slots = HB_QTTHREAD_SLOTS(); @@ -106,6 +108,7 @@ Slots::Slots( QObject* parent ) : QObject( parent ) Slots::~Slots() { + /* TOFIX: Possible leak of PHB_ITEMs stored in list. */ listBlock.clear(); } diff --git a/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp b/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp index 9b9712b35a..91eb570244 100644 --- a/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp +++ b/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp @@ -116,6 +116,7 @@ HB_FUNC( QT_HBDBFMODEL_HBSETROWCOLUMNS ) hbqt_par_HBDbfModel( 1 )->hbSetRowColumns( hb_parni( 2 ), hb_parni( 3 ) ); } +/* TOFIX: Leak if .prg code doesn't call this explicitly. */ HB_FUNC( QT_HBDBFMODEL_DESTROY ) { // BI:TODO fix the GPF hbqt_par_HBDbfModel( 1 )->~HBDbfModel(); diff --git a/harbour/contrib/hbqt/qtgui/QTableView.cpp b/harbour/contrib/hbqt/qtgui/QTableView.cpp index ff3ba1b93e..9bd846d951 100644 --- a/harbour/contrib/hbqt/qtgui/QTableView.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableView.cpp @@ -87,6 +87,7 @@ HB_FUNC( QT_HBQTABLEVIEW_NAVIGATE ) hb_retptr( new QModelIndex( hbqt_par_HBQTableView( 1 )->navigate( hb_parni( 2 ) ) ) ); } +/* TOFIX: Leak if .prg code doesn't call this explicitly. */ HB_FUNC( QT_HBQTABLEVIEW_DESTROY ) { hbqt_par_HBQTableView( 1 )->~HBQTableView(); diff --git a/harbour/contrib/hbqt/qth/QAbstractItemModel.qth b/harbour/contrib/hbqt/qth/QAbstractItemModel.qth index 60b5c208c9..9c343121c4 100644 --- a/harbour/contrib/hbqt/qth/QAbstractItemModel.qth +++ b/harbour/contrib/hbqt/qth/QAbstractItemModel.qth @@ -127,6 +127,7 @@ HB_FUNC( QT_HBDBFMODEL_HBSETROWCOLUMNS ) hbqt_par_HBDbfModel( 1 )->hbSetRowColumns( hb_parni( 2 ), hb_parni( 3 ) ); } +/* TOFIX: Leak if .prg code doesn't call this explicitly. */ HB_FUNC( QT_HBDBFMODEL_DESTROY ) { // BI:TODO fix the GPF hbqt_par_HBDbfModel( 1 )->~HBDbfModel(); diff --git a/harbour/contrib/hbqt/qth/QTableView.qth b/harbour/contrib/hbqt/qth/QTableView.qth index 818d0e9e84..e8bea2f106 100644 --- a/harbour/contrib/hbqt/qth/QTableView.qth +++ b/harbour/contrib/hbqt/qth/QTableView.qth @@ -104,6 +104,7 @@ HB_FUNC( QT_HBQTABLEVIEW_NAVIGATE ) hb_retptr( new QModelIndex( hbqt_par_HBQTableView( 1 )->navigate( hb_parni( 2 ) ) ) ); } +/* TOFIX: Leak if .prg code doesn't call this explicitly. */ HB_FUNC( QT_HBQTABLEVIEW_DESTROY ) { hbqt_par_HBQTableView( 1 )->~HBQTableView();