I would be extremely thankful if you kindly take a little more trouble by testing this variation.
This would help me to narrow down the problem
It is very important for those of us who have chosen xHarbour and Maria_Connect for all our developments.
hb_vmPushSymbol( pDestructor );
hb_vmPush( pObject ); /* Do NOT Forward!!! */
hb_vmSend( 0 ); <-- CRASH HERE!
if( s_AllowDestructors /* && hb_stack_ready */ )
if (pDestructor && pObject)
{
hb_vmPushSymbol(pDestructor);
hb_vmPush(pObject); /* Do NOT Forward!!! */
if (!hb_vmSend(0))
{
// Error handling here, log more details if needed
hb_errInternal(HB_EI_ERRUNRECOV, "Error in hb_vmSend on Borland C 64", NULL, NULL);
}
}
else
{
// Log errors if pDestructor or pObject are invalid
hb_errInternal(HB_EI_ERRUNRECOV, "pDestructor or pObject invalid in Borland C 64", NULL, NULL);
}
#include <stdint.h> // for uint16_t
void hb_clsFinalize( PHB_ITEM pObject )
{
HB_THREAD_STUB
uint16_t uiClass; // Changed from USHORT to uint16_t
if( HB_IS_OBJECT( pObject ) )
uiClass = pObject->item.asArray.value->uiClass;
else
return;
if (pObject == NULL || pObject->item.asArray.value == NULL)
{
// Log or handle the error
return;
}
if (pClass->pDestructor && pObject)
{
hb_vmPushSymbol(pClass->pDestructor->pMessage->pSymbol);
hb_vmPush(pObject);
// Add error handling for hb_vmSend
if (!hb_vmSend(0)) // Handle the case where hb_vmSend fails
{
hb_errInternal(HB_EI_ERRUNRECOV, "hb_vmSend failed", NULL, NULL);
return;
}
}
else
{
hb_errInternal(HB_EI_ERRUNRECOV, "Invalid destructor or object", NULL, NULL);
}
BOOL bCollecting = hb_gcSetCollecting(TRUE);
PHB_SYMB pDestructor = pClass->pDestructor->pMessage->pSymbol;
// Handle errors during destructor execution
if (pDestructor)
{
hb_vmPushSymbol(pDestructor);
hb_vmPush(pObject);
hb_vmSend(0);
}
hb_gcSetCollecting(bCollecting); // Ensure GC is reset even after errors
PHB_ITEM* pObjectCopy = (PHB_ITEM*)malloc(sizeof(PHB_ITEM));
if (pObjectCopy == NULL)
{
// Handle memory allocation failure
return;
}
memcpy(pObjectCopy, pObject, sizeof(PHB_ITEM));
void hb_clsFinalize( PHB_ITEM pObject )
{
HB_THREAD_STUB
uint16_t uiClass;
if (!pObject || !HB_IS_OBJECT(pObject) || !pObject->item.asArray.value) {
// Handle invalid object
return;
}
uiClass = pObject->item.asArray.value->uiClass;
if (uiClass && uiClass <= s_uiClasses)
{
PCLASS pClass = s_pClasses + (uiClass - 1);
if (pClass->pDestructor)
{
if (pClass->uiScope & HB_OO_CLS_DESTRUC_SYMB)
{
assert(hb_stack_ready);
if (s_AllowDestructors)
{
if (hb_stackBaseItem() && hb_stackSelfItem() && strcmp(hb_stackBaseItem()->item.asSymbol.value->szName, "__CLSINSTSUPER"))
{
BOOL bCollecting = hb_gcSetCollecting(TRUE);
PHB_SYMB pDestructor = pClass->pDestructor->pMessage->pSymbol;
if (pDestructor && pObject)
{
hb_vmPushSymbol(pDestructor);
hb_vmPush(pObject);
// Call destructor and handle errors
if (!hb_vmSend(0))
{
hb_errInternal(HB_EI_ERRUNRECOV, "Error in hb_vmSend", NULL, NULL);
}
}
hb_gcSetCollecting(bCollecting);
}
}
else
{
hb_errInternal(HB_EI_ERRUNRECOV, "Destructors disabled!", pClass->szName, NULL);
}
}
}
}
}
B_BOOL hb_vm_ready( void )
{
/* Verificar si la pila de la máquina virtual está inicializada */
if( !hb_stack_ready )
{
return HB_FALSE;
}
/* Verificar si el puntero de la máquina virtual es válido */
if( hb_vm_ptr() == NULL )
{
return HB_FALSE;
}
/* Verificar si el área de memoria de la máquina virtual está inicializada */
if( hb_vmMemoryPtr() == NULL )
{
return HB_FALSE;
}
/* Puedes agregar más verificaciones aquí si es necesario */
return HB_TRUE;
}
void hb_clsFinalize( PHB_ITEM pObject )
{
HB_THREAD_STUB
USHORT uiClass;
if( HB_IS_OBJECT( pObject ) )
uiClass = pObject->item.asArray.value->uiClass;
else
return;
if( uiClass && uiClass <= s_uiClasses )
{
PCLASS pClass = s_pClasses + ( uiClass - 1 );
if( pClass->pDestructor )
{
if( pClass->uiScope & HB_OO_CLS_DESTRUC_SYMB )
{
assert( hb_stack_ready );
if( s_AllowDestructors )
{
if( HB_IS_SYMBOL( hb_stackBaseItem() ) &&
( hb_stackBaseItem()->item.asSymbol.pCargo->uiSuperClass == 0 ||
( USHORT ) hb_stackBaseItem()->item.asSymbol.pCargo->uiSuperClass != uiClass ||
( HB_IS_ARRAY( hb_stackSelfItem() ) &&
hb_stackSelfItem()->item.asArray.value != pObject->item.asArray.value ) ) &&
strcmp( hb_stackBaseItem()->item.asSymbol.value->szName, "__CLSINSTSUPER" ) )
{
BOOL bCollecting = hb_gcSetCollecting( TRUE ), bPop = TRUE;
PHB_SYMB pDestructor = pClass->pDestructor->pMessage->pSymbol;
if( HB_IS_ARRAY( &HB_VM_STACK.Return ) &&
HB_VM_STACK.Return.item.asArray.value == pObject->item.asArray.value )
{
bPop = FALSE;
hb_stackPush();
}
else
hb_vmPushState();
hb_vmPushSymbol( pDestructor );
hb_vmPush( pObject );
#ifdef __BORLANDC__
#if __BORLANDC__ > 0x0580 // Ajusta este valor según la versión de Borland C 64-bit
// Alternativa para 64-bit
if (hb_vm_ready()) // Asume que existe una función como esta
{
// Llama directamente al destructor si es posible
if (pDestructor && pDestructor->value)
{
pDestructor->value(pObject);
}
else
{
// Registra un error o maneja la situación de otra manera
hb_errInternal(HB_EI_ERRUNRECOV, "Unable to call destructor", NULL, NULL);
}
}
else
{
hb_errInternal(HB_EI_ERRUNRECOV, "Harbour VM not ready", NULL, NULL);
}
#else
hb_vmSend( 0 );
#endif
#else
hb_vmSend( 0 );
#endif
if( bPop )
hb_vmPopState();
else
hb_stackDec();
hb_gcSetCollecting( bCollecting );
}
}
else
hb_errInternal( HB_EI_ERRUNRECOV, "Destructors disabled! Destructor of class: '%s' can't be executed.", pClass->szName, NULL );
}
}
}
}
#ifdef MSVC32
#define NXS_MAX_KEYLEN 256
static void nxs_crypt(
const unsigned char * source, HB_SIZE srclen,
const unsigned char * key, HB_SIZE keylen,
unsigned char * cipher );
static void nxs_scramble(
const unsigned char * source, HB_SIZE srclen,
const unsigned char * key, HB_SIZE keylen,
unsigned char * cipher );
static void nxs_partial_scramble(
const unsigned char * source, unsigned char * cipher,
HB_ISIZ * scramble,
HB_SIZE len, HB_SIZE keylen );
static void nxs_xorcode(
unsigned char * cipher, HB_SIZE cipherlen,
const unsigned char * key, HB_SIZE keylen );
static void nxs_xorcyclic(
unsigned char * cipher, HB_SIZE cipherlen,
const unsigned char * key, HB_SIZE keylen );
static HB_U32 nxs_cyclic_sequence( HB_U32 input );
static void nxs_make_scramble(
HB_ISIZ * scramble,
const unsigned char * key,
HB_SIZE keylen );
#else
void nxs_crypt(
const unsigned char *source, HB_SIZE srclen,
const unsigned char *key, HB_SIZE keylen,
unsigned char *cipher );
#endif
error LNK2019: unresolved external symbol _nxs_crypt referenced in function _HB_FUN_MYSQL_CRYPT
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 81 guests