Closed Bug 517070 Opened 15 years ago Closed 13 years ago

Replace manual refcounting of nsTimeouts in nsGlobalWindow.cpp with equialent nsRefPtr usage

Categories

(Core :: General, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla7

People

(Reporter: mozilla+ben, Assigned: wade.cameron)

References

Details

Attachments

(1 file)

I suspect there may be bugs in all the calls to timeout->AddRef() and timeout->Release() found in nsGlobalWindow.cpp. For better or worse, most of them are meticulously commented, e.g. // Hold on to the timeout to ensure it doesn't go away while it's // being handled (aka kungFuDeathGrip). timeout->AddRef(); timeout->mWindow->RunTimeout(timeout); // Drop our reference to the timeout now that we're done with it. timeout->Release(); This kind of discipline is unnecessary and error-prone. Almost all of these usages can be replaced with nsRefPtr stack-based auto-refcounting.
Summary: Replace manual refcounting of nsTimeouts in nsGlobalWindow.cpp with equialent nsRefPtr → Replace manual refcounting of nsTimeouts in nsGlobalWindow.cpp with equialent nsRefPtr usage
Whiteboard: [good first bug]
This is the first patch I've ever written, so let me know if I've done something wrong so I can learn :). There were a couple of instances of calls to AddRef() that didn't seem like they could be removed, but there were two places where AddRef() was called and then Release() called at every point the function returned which have been removed and replaced with an nsRefPtr
Hey, this is great! Thanks! Let's see what jst thinks.
Attachment #538173 - Flags: review?(jst)
Comment on attachment 538173 [details] [diff] [review] Patch to replace a couple of manual ref-countings with automatic Yup, this looks good to me. Thanks Wade!
Attachment #538173 - Flags: review?(jst) → review+
Assignee: nobody → wade.cameron
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla7
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: