Closed Bug 226059 Opened 22 years ago Closed 22 years ago

nsITransferable* nsClipboard::GetTransferable() returns an addrefed raw pointer

Categories

(Core Graveyard :: GFX, defect)

x86
Linux
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: caillon, Assigned: caillon)

Details

(Keywords: memory-leak)

Attachments

(1 file)

There are four implementations of nsClipboard::GetTransferable(), all of which return an |nsITransferable*| which has been addrefed. This contributes to at least one leak: http://lxr.mozilla.org/mozilla/source/widget/src/xlib/nsClipboard.cpp#188
Attached patch Possible patchSplinter Review
Don't addref if you don't advertise it. I left most of the callers keeping strong pointers though, since it is not clear to me on a quick pass that the member transferables can't go away in between calls.
Oops, I meant to point to this with my initial bug comment: http://lxr.mozilla.org/mozilla/source/widget/src/xlib/nsClipboard.cpp#317 317 NS_IF_RELEASE(mTransferable); 318 mTransferable = GetTransferable(aWhichClipboard); 319 NS_ASSERTION(!mTransferable,"mTransferable is null!! see bug 80181"); 320 if (!mTransferable) return NS_ERROR_FAILURE; 321 NS_ADDREF(mTransferable);
Attachment #135793 - Flags: superreview?(blizzard)
Attachment #135793 - Flags: review?(bryner)
Severity: normal → critical
Summary: nsITransferable* nsClipboard::GetTransferable() returns an addrefed pointer → nsITransferable* tTransferable() returns an addrefed pointer
Summary: nsITransferable* tTransferable() returns an addrefed pointer → nsITransferable* nsClipboard::GetTransferable() returns an addrefed pointer
Attachment #135793 - Flags: superreview?(blizzard) → superreview+
Attachment #135793 - Flags: review?(bryner) → review+
Checked in
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Summary: nsITransferable* nsClipboard::GetTransferable() returns an addrefed pointer → nsITransferable* nsClipboard::GetTransferable() returns an addrefed raw pointer
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: