2011-03-21 18:45 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbqt/qtcore/hbqt_init.cpp
  * contrib/hbqt/qtgui/hbqt_init.cpp
    ! Transferred logic of destructors from core to gui.
      The whole lot should be in one source. We cannot 
      control the order of execution of _init_ functions.
      Francessco, take care of these changes.
    
      NOTE: now hbIDE enters, used with all flavours, exits 
            without GPF. The remaining issue is to control 
            memory leaks. Francessco is working onto that.
This commit is contained in:
Pritpal Bedi
2011-03-22 01:57:18 +00:00
parent e42d4c9393
commit 86ff65e79a
2 changed files with 24 additions and 25 deletions

View File

@@ -409,37 +409,15 @@ static void hbqt_registerCallbacks( void )
HB_FUNC( __HBQTCORE ) {;}
static QList<PHB_ITEM> s_PHB_ITEM_tobedeleted;
void hbqt_addDeleteList( PHB_ITEM item )
{
s_PHB_ITEM_tobedeleted << item ;
}
static void hbqt_lib_init( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
QTextCodec * codec = QTextCodec::codecForName( "UTF8" );
QTextCodec::setCodecForTr( codec );
QTextCodec::setCodecForCStrings( codec );
hbqt_registerCallbacks();
}
static void hbqt_lib_exit( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
HB_TRACE( HB_TR_ALWAYS, ( "hbqt_lib_exit, len=%d", s_PHB_ITEM_tobedeleted.size() ) );
int i;
for( i = 0; i < s_PHB_ITEM_tobedeleted.size(); ++i )
{
hb_itemRelease( s_PHB_ITEM_tobedeleted.at( i ) );
HB_TRACE( HB_TR_ALWAYS, ( "hbqt_lib_exit, deleted item %d", i ));
}
}
HB_CALL_ON_STARTUP_BEGIN( _hbqtcore_init_ )

View File

@@ -58,6 +58,7 @@
#include "hbqtinit.h"
#include "hbapierr.h"
#include "hbapiitm.h"
#include "hbvm.h"
#include "hbinit.h"
@@ -82,6 +83,7 @@
#include <QtGui/QKeyEvent>
#include <QtCore/QStringList>
#include <QtCore/QTextCodec>
HB_EXTERN_BEGIN
extern void * hbqt_gcAllocate_QColor( void * pObj, bool bNew );
@@ -592,9 +594,7 @@ static void hbqt_registerCallbacks( void )
/*----------------------------------------------------------------------*/
static QApplication * s_app = NULL;
//static int s_argc;
//static char ** s_argv;
static QList<PHB_ITEM> s_PHB_ITEM_tobedeleted;
HB_FUNC_EXTERN( __HBQTCORE );
@@ -612,6 +612,12 @@ QApplication * __hbqtgui_app( void )
return s_app;
}
void hbqt_addDeleteList( PHB_ITEM item )
{
HB_TRACE( HB_TR_DEBUG, ( "-------------------------hbqt_addDeleteList # %d", s_PHB_ITEM_tobedeleted.size() ) );
s_PHB_ITEM_tobedeleted << item ;
}
static void hbqt_lib_init( void * cargo )
{
static int s_argc;
@@ -631,11 +637,26 @@ static void hbqt_lib_init( void * cargo )
HB_TRACE( HB_TR_DEBUG, ( "hbqt_lib_init %p", s_app ) );
hbqt_registerCallbacks();
QTextCodec * codec = QTextCodec::codecForName( "UTF8" );
QTextCodec::setCodecForTr( codec );
QTextCodec::setCodecForCStrings( codec );
}
static void hbqt_lib_exit( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
int i;
for( i = s_PHB_ITEM_tobedeleted.size() - 1; i >= 0; --i )
{
if( s_PHB_ITEM_tobedeleted.at( i ) != NULL )
{
HB_TRACE( HB_TR_DEBUG, ( "hbqt_lib_exit, deleted item %d", i ));
hb_itemRelease( s_PHB_ITEM_tobedeleted.at( i ) );
s_PHB_ITEM_tobedeleted[ i ] = NULL;
HB_TRACE( HB_TR_DEBUG, ( " hbqt_lib_exit, deleted item %d", i ));
}
}
}