diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 342b2fbe42..62e5eaa90d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-07-02 22:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtcore/hbqt_bind.cpp + % Optimized: hbqt_bindDestroyQtObject(). + This might resolve double-freeing of objects on Linux. + + * contrib/hbqt/tests/demoqt.prg + + Enabled: Build_Tree() function. + 2012-07-02 16:01 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth ! Fixed: regression as per prev commit. diff --git a/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp b/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp index 75c2fc53ea..43e7127dda 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp @@ -607,34 +607,18 @@ void hbqt_bindDestroyQtObject( void * qtObject, QObject * qObject ) { if( qtObject ) { + qObject->disconnect(); + PHBQT_BIND bind = hbqt_bindGetBindByQtObject( qtObject ); if( bind != NULL ) { - if( bind->pDelFunc != NULL ) - { - HB_TRACE( HB_TR_DEBUG, ( "............QT_DESTROYS( %i, %i, %p, %s )..............", bind->iThreadId, bind->iFlags, bind->qtObject, bind->szClassName ) ); + HB_TRACE( HB_TR_DEBUG, ( "............QT_DESTROYS( %i, %i, %p, %s )..............", bind->iThreadId, bind->iFlags, bind->qtObject, bind->szClassName ) ); - int iFlags = bind->iFlags; - PHBQT_DEL_FUNC pDelFunc = bind->pDelFunc; - qObject->disconnect(); - if( bind->fEventFilterInstalled ) - { - qObject->removeEventFilter( hbqt_bindGetThreadData()->pReceiverEvents ); - } - hbqt_bindRemoveBind( bind ); - pDelFunc( qtObject, iFlags ); /* Though this is not needed as Qt will delete the object, - * but may be because Harbour uses is own memory manager, - * it seems necessary to reclaim the memory. - */ - } - else + if( bind->fEventFilterInstalled ) { - hbqt_bindRemoveBind( bind ); /* Conceptually it must not reach here, but... It is Qt */ + qObject->removeEventFilter( hbqt_bindGetThreadData()->pReceiverEvents ); } - } - else - { - qObject->disconnect(); + hbqt_bindRemoveBind( bind ); } } } diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 6c39fd5e86..a9f015164c 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -349,11 +349,7 @@ STATIC FUNCTION Build_Tabs( oWnd, aPos, aSize ) RETURN { aCtrls } /*----------------------------------------------------------------------*/ -#if 1 -STATIC FUNCTION Build_TreeView( oWnd ) - HB_SYMBOL_UNUSED( oWnd ) - RETURN NIL -#else + STATIC FUNCTION Build_TreeView( oWnd ) LOCAL oDirModel LOCAL oTV @@ -369,7 +365,7 @@ STATIC FUNCTION Build_TreeView( oWnd ) OTV:show() RETURN NIL -#endif + /*----------------------------------------------------------------------*/ STATIC FUNCTION Build_ListBox( oWnd, aPos, aSize )