Closed Bug 1168169 Opened 9 years ago Closed 7 years ago

Change nsThreadShutdownContext::joiningThread to use nsRefPtr and mark as MOZ_STACK_CLASS

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: nika, Assigned: nika)

Details

Attachments

(1 file, 3 obsolete files)

Attachment #8610197 - Flags: review?(benjamin)
Attachment #8610197 - Flags: review?(benjamin) → review?(nfroyd)
Comment on attachment 8610197 [details] [diff] [review]
Change nsThreadShutdownContext::joiningThread to use nsRefPtr and mark as MOZ_STACK_CLASS

Review of attachment 8610197 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the change below.

::: xpcom/threads/nsThread.cpp
@@ +235,2 @@
>  {
> +  nsRefPtr<nsThread> joiningThread;

I don't think there's any need for refcounting this; the thread manager is holding a reference to |joiningThread| and isn't going to let that go while we're running the code in question.  Like other cases, this can be MOZ_NON_OWNING_REF.
Attachment #8610197 - Flags: review?(nfroyd) → review+
I think that MOZ_UNSAFE_REF would be a more appropriate annotation in this scenario.
Attachment #8610197 - Attachment is obsolete: true
Attachment #8623092 - Flags: review?(nfroyd)
Comment on attachment 8623092 [details] [diff] [review]
Mark nsThreadShutdownContext::joiningThread as MOZ_UNSAFE_REF and mark as MOZ_STACK_CLASS

Review of attachment 8623092 [details] [diff] [review]:
-----------------------------------------------------------------

*shrug*  OK.
Attachment #8623092 - Flags: review?(nfroyd) → review+
You want to land this? :)
Flags: needinfo?(michael)
I guess this is what happens when you forget to mark yourself as the assignee :P.

MozReview-Commit-ID: 16ebijitZcz
Attachment #8623092 - Attachment is obsolete: true
Looking at this more it seems like the situation has changed since this patch
was originally written. nsThreadShutdownContext is allocated on the heap behind
a nsAutoPtr, so we can't mark it as MOZ_STACK_CLASS.

MozReview-Commit-ID: 16ebijitZcz
Attachment #8858896 - Flags: review?(nfroyd)
Attachment #8858891 - Attachment is obsolete: true
Assignee: nobody → michael
Flags: needinfo?(michael)
Comment on attachment 8858896 [details] [diff] [review]
Mark nsThreadShutdownContext::joiningThread as MOZ_UNSAFE_REF

Review of attachment 8858896 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks.

Does the static analysis look through templated types to find raw pointers?  The documentation for MOZ_UNSAFE_REF says it only applies to pointers...please be sure that you're not going to break the static analysis jobs before you land this.
Attachment #8858896 - Flags: review?(nfroyd) → review+
Pushed by michael@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/14f4b3a2ca15
Mark nsThreadShutdownContext::joiningThread as MOZ_UNSAFE_REF, r=froydnj
https://hg.mozilla.org/mozilla-central/rev/14f4b3a2ca15
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: