Closed Bug 495075 Opened 11 years ago Closed 11 years ago

pUnkForRelease incorrectly assigned in nsDataObj::GetFileContents_IStream

Categories

(Core :: Widget: Win32, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: rain1, Assigned: rain1)

References

Details

Attachments

(1 file)

Attached patch patchSplinter Review
According to <http://msdn.microsoft.com/en-us/library/ms693491(VS.85).aspx>, assigning the same pointer to both pstm and pUnkForRelease will cause Windows to AddRef() the pointer once (for pstm) but Release() it twice (for both pstm and pUnkForRelease). This leads to random crashes in debug mode when we drag/drop and stream the data.

I've verified that the refcount goes to 0 with this patch, so there shouldn't be a memory leak.

Another approach might be for us to AddRef() once.
Attachment #379897 - Flags: superreview?(roc)
Attachment #379897 - Flags: review?(emaijala)
Oops -- sorry for the minimal context. The line I'm changing is this one: <http://mxr.mozilla.org/mozilla-central/source/widget/src/windows/nsDataObj.cpp#2004>
Attachment #379897 - Flags: superreview?(roc) → superreview+
Attachment #379897 - Flags: review?(emaijala) → review+
Pushed to m-c: http://hg.mozilla.org/mozilla-central/rev/b458d73bbe83
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
You need to log in before you can comment on or make changes to this bug.