RESOLVED FIXED 144474
DOM bindings should not be using a reference type to point to a temporary object
https://bugs.webkit.org/show_bug.cgi?id=144474
Summary DOM bindings should not be using a reference type to point to a temporary object
Oliver Hunt
Reported 2015-04-30 15:21:54 PDT
DOM bindings should not be using a reference type to point to a temporary object
Attachments
Patch (2.94 KB, patch)
2015-04-30 15:27 PDT, Oliver Hunt
bdakin: review+
Oliver Hunt
Comment 1 2015-04-30 15:27:16 PDT
Oliver Hunt
Comment 2 2015-04-30 15:41:44 PDT
Alexey Proskuryakov
Comment 3 2015-04-30 17:06:50 PDT
This broke bindings tests (need new results landed). I'm not sure if analysis in this patch is accurate, references sometimes do extend the lifetime of an object, even though that's counter-intuitive.
Darin Adler
Comment 4 2015-05-01 07:23:31 PDT
I don’t think this patch is correct; I would like more information about the problem here, and how the problem was solved. Alexey’s point is one possible source of misunderstanding that I am suspecting.
Darin Adler
Comment 5 2015-05-01 07:24:28 PDT
I’m particularly concerned about the change to %nativeType. I believe the change to the local variable pointing to existing_name is unnecessary but harmless.
Oliver Hunt
Comment 6 2015-05-01 07:56:52 PDT
native type is used to define the type used for a local, the bug here occurs when we assign a temporary to a local reference. It does result in incorrect behavior and this trivially provable by making refptr clear the pointer reference in its destructor. The outcome is a huge number of tests failing courtesy of references to dead refptrs
Alexey Proskuryakov
Comment 7 2015-05-01 12:15:33 PDT
Here is the change that this patch made in generated code: <https://build.webkit.org/builders/Apple%20Yosemite%20Release%20WK2%20%28Tests%29/builds/4924/steps/bindings-generation-tests/logs/stdio>. The reference used to be initialized from a ternary operator, which complicates things. Oliver told me that he is working on a minimal C++ test demonstrating that a reference doesn't extend object lifetime in this case (either correctly, or due to a clang bug).
Note You need to log in before you can comment on or make changes to this bug.