[Webkit-unassigned] [Bug 16401] [GTK] GObject/C DOM binding
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Dec 2 02:25:10 PST 2008
https://bugs.webkit.org/show_bug.cgi?id=16401
------- Comment #105 from mrowe at apple.com 2008-12-02 02:25 PDT -------
(In reply to comment #104)
> > The offending code looks as follows
> >
> > 197: PassRefPtr<WebCore::Element> ptr = gself->ownerElement();
> > 198: g_value_set_object (value, WebKit::toGDOM(ptr.get()));
>
> this is exactly what the javascript code does.
>
> the pointer is stored in a RefPtr<WebCore::Element> in the "internal"
> c++ class that has GDOMObject as its base: a private member called m_impl.
The JavaScript bindings do not create a local PassRefPtr to pass in to toJS, as
the code quoted above does.
What you describe relates to how the wrapper holds the reference to the wrapped
object. Holding it as a RefPtr is indeed what the JavaScript bindings do, and
what most (all?) bindings layers should do. The Objective-C bindings don't do
this for historical reasons.
> perhaps the solution to satisfy mark's concerns is as simple a matter of
> removing the calls to ref() and deref() - i'll see what effect that has.
Using ref() and deref() manually without a specific need to do so is a good
indication that reference counting is being handled incorrectly. The latest
iteration of the patch still appears to have problems in this area.
One part of the patch doesn't quite make sense to me: what is the relationship
between the generated "_${className}Private" structures and
_GdomDOMObjectPrivate? They both contain members named coreObject, but only
the former uses a RefPtr for this purpose. This seems as though it could lead
to confusion.
> the calls to ref() and deref() were added from copying the style of
> the ObjC bindings DOMObject cacheing.
The Objective-C bindings manually ref and deref raw pointers because their
existence predates compiler support for storing non-POD C++ objects as members
of Objective-C classes. The compiler has since grown support for this feature,
but we've not had a chance to update the Obj-C DOM bindings to use RefPtrs.
--
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