Szakáts Viktor escribió:
[ yes Javier, but also notice that indenting is just two
chars deep, not to mention the usage of 'begindump'.. :-P ]

I take note  :'(
I think the problem is that you're reassigning
'h' after debug( "1" ), which makes it lose it's
value, thus initiating the destructor, and at the
same time it won't get a new value, because myfunc()
will get the non-NULL parameter, which will be
reassigned to 'h' as is.

...
1. debug( "1" )
2. execute myfunc( h )
3. do nothing (value of ptr will just fall through), since h is not NULL at this point
4. assign value to h
4a. free up old value of h
Thanks Viktor, now I will take care with the use of hb_itemPutPtrGC() because which I am working doesn't do the same. :(

PHB_ITEM HB_EXPORT hb_itemPutPtrGC( PHB_ITEM pItem, void * pValue )
{
  HB_TRACE_STEALTH(HB_TR_DEBUG, ("hb_itemPutPtr(%p, %p)", pItem, pValue));

  hb_gcIncRef( pValue );

  pItem = hb_itemPutPtr( pItem, pValue );
  pItem->item.asPointer.collect = TRUE;

  return pItem;
}

Best regards
Xavi
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to