WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
43735
C++ DOM binding classes with private structs need operator= overload
https://bugs.webkit.org/show_bug.cgi?id=43735
Summary
C++ DOM binding classes with private structs need operator= overload
Kevin Ollivier
Reported
2010-08-09 11:35:13 PDT
C++ DOM binding classes which have a private struct that manages the WebCore pointer already have a copy constructor defined that passes the pointer properly, but they do not define operator= so outside of construction, assignment leads to a crash, since it does a simple copy of the private structure rather than creating a new one and assigning the pointer.
Attachments
Add operator= overloads to C++ DOM binding classes with private structs.
(3.20 KB, patch)
2010-08-09 11:38 PDT
,
Kevin Ollivier
no flags
Details
Formatted Diff
Diff
Patch updated with bindings test outputs updated.
(7.79 KB, patch)
2010-08-09 21:48 PDT
,
Kevin Ollivier
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Kevin Ollivier
Comment 1
2010-08-09 11:38:30 PDT
Created
attachment 63912
[details]
Add operator= overloads to C++ DOM binding classes with private structs.
Geoffrey Garen
Comment 2
2010-08-09 11:40:45 PDT
Are there cases where assignment is used like this? If so, you should be able to write a layout test. If assignment is not used like this, I suggest just forbidding assignment, in the same way the Noncopyable class does.
Geoffrey Garen
Comment 3
2010-08-09 11:41:50 PDT
Comment on
attachment 63912
[details]
Add operator= overloads to C++ DOM binding classes with private structs. r- because the new code in this patch does not include a test.
Kevin Ollivier
Comment 4
2010-08-09 11:52:17 PDT
(In reply to
comment #2
)
> Are there cases where assignment is used like this? If so, you should be able to write a layout test.
Yes, I ran into this problem when generating Python wrappers for these bindings. The SWIG tool does something along these lines (code simplified to show the relevant bits): WebDOMNode result; { result = range->startContainer(); } swigptr = new WebDOMNode(result); The block assigning result has some extra error handling code, etc. which is why they isolate it in a code block. As for the LayoutTest part, does WebDOM* have a test suite yet? If so I'll be happy to add a case for it.
> If assignment is not used like this, I suggest just forbidding assignment, in the same way the Noncopyable class does.
For a public API like the WebDOM* classes, I'm concerned that making the objects non-copyable would be pretty restrictive. (And, of course, it would really set me back on trying to get Python bindings working.)
Geoffrey Garen
Comment 5
2010-08-09 15:33:27 PDT
Comment on
attachment 63912
[details]
Add operator= overloads to C++ DOM binding classes with private structs. Okeedokee. I don't think WebDOM* has a test suite yet. That's a shame, but it's not the fault of this patch. r=me
Darin Adler
Comment 6
2010-08-09 16:12:20 PDT
Comment on
attachment 63912
[details]
Add operator= overloads to C++ DOM binding classes with private structs. You’ll need to update the test results checked in at the directory WebCore/bindings/cpp as well.
Kevin Ollivier
Comment 7
2010-08-09 21:48:47 PDT
Created
attachment 63974
[details]
Patch updated with bindings test outputs updated. Thanks for catching the bindings test updates! I didn't realize these were in the tree. New patch up now with them added. Note that there are a couple other changes (with the ENABLE(Conditional)) in one of the test headers as well, this is from a change in a previous commit (the C++ DOM bindings wasn't enclosing the function definitions with the conditional #if, only their implementations) and the results are correct.
Adam Barth
Comment 8
2010-08-10 23:26:02 PDT
Comment on
attachment 63974
[details]
Patch updated with bindings test outputs updated. Forwarding ggaren's r+.
WebKit Commit Bot
Comment 9
2010-08-11 05:31:11 PDT
Comment on
attachment 63974
[details]
Patch updated with bindings test outputs updated. Clearing flags on attachment: 63974 Committed
r65147
: <
http://trac.webkit.org/changeset/65147
>
WebKit Commit Bot
Comment 10
2010-08-11 05:31:16 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug