Bug 238070

Summary: [GLIB] Make it possible to call GRefPtr::outPtr() multiple times wihtout an explicit clear
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: Web Template FrameworkAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, aperez, benjamin, bugs-noreply, calvaris, cdumez, cmarcelo, ews-watchlist, gyuyoung.kim, pnormand, ryuan.choi, sergio, webkit-bug-importer
Priority: P2 Keywords: Gtk, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=236540
Attachments:
Description Flags
Patch none

Description Carlos Garcia Campos 2022-03-18 04:51:46 PDT
Clear the GRefPtr before returning the value in outPtr(), similar to what GUniqueOutPtr does, since it's easy to forget to explicitly call clear from the callers.
Comment 1 Carlos Garcia Campos 2022-03-18 04:55:19 PDT
Created attachment 455086 [details]
Patch
Comment 2 Adrian Perez 2022-03-18 05:55:26 PDT
Comment on attachment 455086 [details]
Patch

LGTM, it may make sense to fix the style checker issue while at it.
Comment 3 Carlos Garcia Campos 2022-03-18 05:58:36 PDT
Style failure doesn't matter here, because the file is not the implementation of any class, so there's no header tom include. I think there was a way to workaround it, but I'm not sure it's worth it for a unit test
Comment 4 Adrian Perez 2022-03-18 06:17:46 PDT
(In reply to Carlos Garcia Campos from comment #3)
> Style failure doesn't matter here, because the file is not the
> implementation of any class, so there's no header tom include. I think there
> was a way to workaround it, but I'm not sure it's worth it for a unit test

Maybe let's just not mind it, then :)
Comment 5 Carlos Garcia Campos 2022-03-18 07:19:56 PDT
Committed r291482 (248596@trunk): <https://commits.webkit.org/248596@trunk>
Comment 6 Radar WebKit Bug Importer 2022-03-18 07:20:53 PDT
<rdar://problem/90484376>