Bug 213415 - [AppSSO] Should do null check on m_page in dismissViewController()
Summary: [AppSSO] Should do null check on m_page in dismissViewController()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jiewen Tan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-19 16:30 PDT by Jiewen Tan
Modified: 2020-06-20 23:10 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.47 KB, patch)
2020-06-19 16:34 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (1.68 KB, patch)
2020-06-19 19:07 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (1.70 KB, patch)
2020-06-20 00:41 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiewen Tan 2020-06-19 16:30:48 PDT
Use protectedThis for dismissViewController().
Comment 1 Jiewen Tan 2020-06-19 16:31:00 PDT
<rdar://problem/59672418>
Comment 2 Jiewen Tan 2020-06-19 16:34:28 PDT
Created attachment 402343 [details]
Patch
Comment 3 Darin Adler 2020-06-19 17:10:12 PDT
Comment on attachment 402343 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402343&action=review

> Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:305
> -                dismissViewController();
> +                protectedThis->dismissViewController();

There are tons of cases where we capture "this" in protectedThis, but then use "this" relying on the protection indirectly. Why is it important to change this one? I see no reason to make this change, but to leave the code two lines later using this to null out m_presentingWindowDidDeminiaturizeObserver.

I like the idea of always using protectedThis, but I would do this and not even capture this, and even then, I am not sure we need to make a change. It’s a repeating pattern in a lot of different code in WebKit.
Comment 4 Jiewen Tan 2020-06-19 18:58:55 PDT
Comment on attachment 402343 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402343&action=review

>> Source/WebKit/UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:305
>> +                protectedThis->dismissViewController();
> 
> There are tons of cases where we capture "this" in protectedThis, but then use "this" relying on the protection indirectly. Why is it important to change this one? I see no reason to make this change, but to leave the code two lines later using this to null out m_presentingWindowDidDeminiaturizeObserver.
> 
> I like the idea of always using protectedThis, but I would do this and not even capture this, and even then, I am not sure we need to make a change. It’s a repeating pattern in a lot of different code in WebKit.

Thanks for pointing it out. I was confused as well. I have received a crash report indicating Line 317 could crash, and therefore this is the most reasonable patch I could come out with. Now after reading other crash logs, it turns out that those crashed at a different place which actually makes sense. Will upload another patch.
Comment 5 Jiewen Tan 2020-06-19 19:07:38 PDT
Created attachment 402370 [details]
Patch
Comment 6 Alexey Proskuryakov 2020-06-19 19:38:50 PDT
Comment on attachment 402370 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402370&action=review

> Source/WebKit/ChangeLog:3
> +        [AppSSO] Use protectedThis for dismissViewController()

This is not what this patch is about.
Comment 7 Jiewen Tan 2020-06-20 00:40:56 PDT
Comment on attachment 402370 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402370&action=review

>> Source/WebKit/ChangeLog:3
>> +        [AppSSO] Use protectedThis for dismissViewController()
> 
> This is not what this patch is about.

Oops. Forgot to update the change log.
Comment 8 Jiewen Tan 2020-06-20 00:41:19 PDT
Created attachment 402379 [details]
Patch
Comment 9 Alexey Proskuryakov 2020-06-20 12:39:38 PDT
Comment on attachment 402379 [details]
Patch

That's one of the reasons why it's better to put the symptom/motivation into radar title, not a description of what change is being made.
Comment 10 Jiewen Tan 2020-06-20 23:06:06 PDT
(In reply to Alexey Proskuryakov from comment #9)
> Comment on attachment 402379 [details]
> Patch
> 
> That's one of the reasons why it's better to put the symptom/motivation into
> radar title, not a description of what change is being made.

Got you. Will do that next time.
Comment 11 Jiewen Tan 2020-06-20 23:06:41 PDT
Comment on attachment 402379 [details]
Patch

Thanks Alexey for r+ this patch.
Comment 12 EWS 2020-06-20 23:10:41 PDT
Committed r263324: <https://trac.webkit.org/changeset/263324>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 402379 [details].