Closed Bug 295145 Opened 20 years ago Closed 19 years ago

nsUCSupport releases wrong pointer

Categories

(Core :: Internationalization, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Biesinger, Assigned: mcsmurf)

References

()

Details

(Keywords: fixed1.8)

Attachments

(1 file, 1 obsolete file)

569 NS_IMETHODIMP nsEncoderSupport::SetOutputErrorBehavior(
570                                 PRInt32 aBehavior, 
571                                 nsIUnicharEncoder * aEncoder, 
572                                 PRUnichar aChar)
[...]
577   NS_IF_RELEASE(aEncoder);
578   mErrEncoder = aEncoder;
579   NS_IF_ADDREF(aEncoder);

the release should probably refer to mErrEncoder.
and it looks like other implementations of this functions get this wrong as well...
Biesi, is this code not used or something?  How come it't not crashing later
when using mErrEncoder?
I assume few, if any, callers set an aEncoder, yes.
Attached patch Patch (obsolete) — Splinter Review
Attachment #190855 - Attachment is obsolete: true
Attached patch PatchSplinter Review
Attachment #190856 - Flags: superreview?(jshin1987)
Attachment #190856 - Flags: review?(jshin1987)
Comment on attachment 190856 [details] [diff] [review]
Patch

r=jshin
Attachment #190856 - Flags: superreview?(jshin1987)
Attachment #190856 - Flags: superreview?(dbaron)
Attachment #190856 - Flags: review?(jshin1987)
Attachment #190856 - Flags: review+
Attachment #190856 - Flags: superreview?(dbaron) → superreview+
Comment on attachment 190856 [details] [diff] [review]
Patch

would it be more readable if this:
   NS_IF_ADDREF(aEncoder);
were changed to:
   NS_IF_ADDREF(mErrEncoder); 
?
Is there any reason not to check this in?
Assignee: smontagu → bugzilla
Past Frank not having CVS access?  No.
Checked in with the change from comment 7.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment on attachment 190856 [details] [diff] [review]
Patch

I think we should take this for 1.8.
Attachment #190856 - Flags: approval1.8b4?
Attachment #190856 - Flags: approval1.8b4? → approval1.8b4+
Checked in on 1.8 branch.
Keywords: fixed1.8
I think this caused bug 306493 because none of these classes' constructors
actually initialize mErrEncoder to null.  It should just be an nsCOMPtr anyway...
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: