[Webkit-unassigned] [Bug 16401] [GTK] GObject/C DOM binding

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 11 06:23:35 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=16401





------- Comment #139 from soto at informatik.uni-kl.de  2009-02-11 06:23 PDT -------
(In reply to comment #132)
> (In reply to comment #128) 
> > Because we've eliminated the private structure, we can't use a C++ smart
> > pointer to point to the native C++ object, and so we call ref() manually when a
> > GObject wrapper is initialized and call deref() when it's finalized.
> 
>  ahh... the use of ref() and deref() were a key reason why the existing
>  patch was not accepted.  mark cited "use of ref() and deref() typically
>  indicate broken code and/or broken design".

I don't think anyone is being so religious regarding this issue. Thing is,
apparently random ref() and deref() thrown around the code don't look like
something that is likely to be robust. The strategy taken by Adam, on the other
hand, is quite sound, namely, you ref objects once when they are wrapped and
deref them once when the wrapper is destroyed. It is as easy as that. Also, the
reason you must use explicit ref() and deref() instead of a vanilla RefPtr is
that the pointer is inside a C structure.

As I said in my previous comment, I tested this strategy at home and it worked
really well. It seems to be the most maintainable of the options available and
any problems with code readability should be solvable with a few well placed
comments.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list