WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
258608
Generated IPC serializers for MoveOnlyBaseClass&& are incorrect
https://bugs.webkit.org/show_bug.cgi?id=258608
Summary
Generated IPC serializers for MoveOnlyBaseClass&& are incorrect
Kimmo Kinnunen
Reported
2023-06-27 23:44:12 PDT
Generated IPC serializers forMoveOnlyBaseClass&& are incorrect It appears that the code tries to implement move through base class rvalue reference. It is not possible in general case following c++ rvalue semantics, as rvalue constructors are not polymorphic. Move makes no sense: void ArgumentCoder<WebCore::MoveOnlyBaseClass>::encode(Encoder& encoder, WebCore::MoveOnlyBaseClass&& instance) { if (auto* subclass = dynamicDowncast<WebCore::MoveOnlyDerivedClass>(instance)) { encoder << WebCore_MoveOnlyBaseClass_Subclass::MoveOnlyDerivedClass; encoder << WTFMove(*subclass); return; } ASSERT_NOT_REACHED(); }
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-07-04 23:45:17 PDT
<
rdar://problem/111768907
>
Kimmo Kinnunen
Comment 2
2023-10-27 00:22:08 PDT
Maybe you're right that when using downcast, it is consistent with by-ref encoding. I don't remember what was the idea why it's bad. The only thing I could re-comeup with is that MoveOnlyDerivedClass might not be the final class, so then moving parts of the class is not ok. Comparing to by-ref encoding, copying only part of the class is ok from the safety perspective. However, it's not probably intended so both would be equally buggy and as such rvalue ref code would be consistent with ref code.
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