Summary: | [WebGPU] [NSString stringWithCString:encoding:] fails on a null pointer | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Myles C. Maxfield <mmaxfield> | ||||
Component: | WebGPU | Assignee: | Myles C. Maxfield <mmaxfield> | ||||
Status: | RESOLVED DUPLICATE | ||||||
Severity: | Normal | CC: | dino, djg, kkinnunen | ||||
Priority: | P2 | ||||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | 237871 | ||||||
Bug Blocks: | 237583, 237876 | ||||||
Attachments: |
|
Description
Myles C. Maxfield
2022-03-14 21:55:33 PDT
Created attachment 454661 [details]
Patch
Comment on attachment 454661 [details]
Patch
I think API type conversion should be done ASAP, e.g. a layer below. You wouldn't write "const char*" in WebKit level code, so why WebGPU level code.
For me, overloaded ToAPI, FromAPI functions have been useful. In this case you would have String FromAPI(const char*) or NSString* FromAPI(const char*)
and the code would be like void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, const char* label) { FromAPI(bindGroup)->setLabel(FromAPI(label)); } *** This bug has been marked as a duplicate of bug 237942 *** (In reply to Kimmo Kinnunen from comment #2) > Comment on attachment 454661 [details] > Patch > > I think API type conversion should be done ASAP, e.g. a layer below. You > wouldn't write "const char*" in WebKit level code, so why WebGPU level code. > For me, overloaded ToAPI, FromAPI functions have been useful. In this case > you would have String FromAPI(const char*) or NSString* FromAPI(const char*) https://bugs.webkit.org/show_bug.cgi?id=237942 [WebGPU] Use the fromAPI() pattern |