[Webkit-unassigned] [Bug 16401] [GTK] GObject/C DOM binding
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Dec 1 15:01:20 PST 2008
https://bugs.webkit.org/show_bug.cgi?id=16401
------- Comment #101 from soto at informatik.uni-kl.de 2008-12-01 15:01 PDT -------
(In reply to comment #100)
> Can you provide a bit more detail about what you tried here, and what errors
> you ran in to?
Sure. The functions are declared as follows:
gpointer toGDOM(WebCore::CSSValue* node);
gpointer toGDOM(WebCore::Document* node);
gpointer toGDOM(WebCore::Element* node);
gpointer toGDOM(WebCore::Event* node);
There are more, but you get the idea. These functions actually wrap the node
object into a GObject and return it. If I change them to
gpointer toGDOM(PassRefPtr<WebCore::CSSValue> node);
gpointer toGDOM(PassRefPtr<WebCore::Document> node);
gpointer toGDOM(PassRefPtr<WebCore::Element> node);
gpointer toGDOM(PassRefPtr<WebCore::Event> node);
I get error messages such as the following (this is just the first file that
fails):
DerivedSources/gdom/GdomAttr.cpp: In function void
gdom_attr__get_property_fn(GObject*, guint, GValue*, GParamSpec*):
DerivedSources/gdom/GdomAttr.cpp:198: error: call of overloaded
toGDOM(WebCore::Element*) is ambiguous
./WebCore/bindings/gdom/GDOMBinding.h:61: note: candidates are: void*
WebKit::toGDOM(WTF::PassRefPtr<WebCore::Element>)
./WebCore/bindings/gdom/GDOMBinding.h:63: note: void*
WebKit::toGDOM(WTF::PassRefPtr<WebCore::EventTarget>)
./WebCore/bindings/gdom/GDOMBinding.h:64: note: void*
WebKit::toGDOM(WTF::PassRefPtr<WebCore::EventTargetNode>)
./WebCore/bindings/gdom/GDOMBinding.h:66: note: void*
WebKit::toGDOM(WTF::PassRefPtr<WebCore::Node>)
The offending code looks as follows
197: PassRefPtr<WebCore::Element> ptr = gself->ownerElement();
198: g_value_set_object (value, WebKit::toGDOM(ptr.get()));
Line 198 fails with the messages above. When the toGDOM functions are declared
with raw pointer parameters, it compiles and runs properly.
> There will be no need to give each variant of the function a
> distinct name. A simpler workaround if you can't convince the PassRefPtr
> approach to work would be to use a raw pointer. PassRefPtr is a matter of
> optimization, not correctness.
Leaving the raw-pointer parameters is probably the solution, but I'm not sure
if calling the toGDOM functions as shown above is the right way to do it. In
particular, the local PassRefPtr variable looks suspicious to me, but it's hard
for me to tell if this is OK in this particular case. I'd really appreciate
some help here.
By the way, should I ask these type of questions somewhere else? (IRC?, mailing
list?)
--
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