Hi,

Viktor Szakáts wrote:
2) I'm a little confused how to implement GC pointers. So, I've implemented two version 
in hbcairo/core.c. It can be selected [not]using HB_USE_ITEM define. In current code the 
switch is not defined and more "low level" version is used (actually, I even 
forgot to test using HB_USE_ITEM). Are these GC pointer implementations correct? A few 
subquestions are:

2a) hb_gcRefInc()/hb_gcRefDec() is required without HB_USE_ITEM. This requires 
define _HB_API_INTERNAL_. Is this OK?

If there is some sort of special case with cairo, that cannot be solved with current public API, we should think about how to change the public API to make a proper solution possible.

I did not want to use extra container for GC pointer. This code operates on low level things like GC mark and programmer must know how GC work, so I do not think it can not use hb_gcRefInc/Dec. These functions are not more internal in that context.

I do not think there is something special in cairo. These GC references was implemented just a few weeks ago, so, I think cairo is only one of first code that started to use it.

I've tried to look at OLE implementation, and this does not look very clean to me. In HB_OLE GC structure, pCallback is a pointer to PHB_ITEM (not PHB_ITEM itself) and it points to callback item from ISink object from ActiveX. It is not obvious that ISink object will not be released before HB_OLE will be destroyed (otherwise HB_OLE->pCallback can point to random memory content). hb_gcUnlock in olecore.c:248 is much more difficult to understand, that hb_gcRefInc/Dec in cairo code. I understand that there is a little different situation callback support. Storing pointer to PHB_CODEBLOCK is touching internals of Harbour VM and you could not store PHB_CODEBLOCK in HB_OLE, but in cairo code GC block containing cairo_t* is not a hidden internal - you need to operate on it. Though, all such code is placed in hbcairo/core.c and not accessable from outside.


I hope Przemek add his comments on this.

Yes, comment would be very valuable.



Regards,
Mindaugas
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to