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

RESOLVED FIXED

Status

Core Graveyard
GFX
--
critical
RESOLVED FIXED
15 years ago
10 years ago

People

(Reporter: Christopher Aillon (sabbatical, not receiving bugmail), Assigned: Christopher Aillon (sabbatical, not receiving bugmail))

Tracking

({memory-leak})

Trunk
x86
Linux
memory-leak

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

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
Created attachment 135793 [details] [diff] [review]
Possible patch

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)

Updated

15 years ago
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+

Updated

15 years ago
Attachment #135793 - Flags: review?(bryner) → review+
Checked in
Status: NEW → RESOLVED
Last Resolved: 15 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.