The default bug view has changed. See this FAQ.

Possible double release of a NSColor

RESOLVED FIXED in mozilla12

Status

()

Core
Widget: Cocoa
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: hub, Assigned: hub)

Tracking

Trunk
mozilla12
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [inbound])

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
in nsCocoaWindow.mm around line 2318
in the method -[ToolbarWindow initWithContentRect:...], we do mBackgroundColor = [NSColor whiteColor]. but in the dealloc, we do [mBackgroundColor release] which leads so do we in -[ToolbarWindow setBackgroundColor:].

[NSColor whiteColor] returns an "autoreleased", therefor we should retain it.

The fact that it does not crash is surprising, albeit maybe not as it is entirely possible that the framework returns a static instance. But this is implementation dependent.

Will attach a patch.
(Assignee)

Comment 1

5 years ago
Created attachment 584805 [details] [diff] [review]
[NSColor whiteColor] must be retained in ToolbarWindow. r=
(Assignee)

Updated

5 years ago
Attachment #584805 - Flags: review?(smichaud)
Comment on attachment 584805 [details] [diff] [review]
[NSColor whiteColor] must be retained in ToolbarWindow. r=

I also don't know why we don't crash, but this is the right thing to do.
Attachment #584805 - Flags: review?(smichaud) → review+
(Assignee)

Updated

5 years ago
Attachment #584805 - Flags: checkin?(smichaud)
Comment on attachment 584805 [details] [diff] [review]
[NSColor whiteColor] must be retained in ToolbarWindow. r=

Landed on mozilla-inbound:
http://hg.mozilla.org/integration/mozilla-inbound/rev/0022f8be9fea
Attachment #584805 - Flags: checkin?(smichaud) → checkin+
Whiteboard: [inbound]
Assignee: nobody → hub
https://hg.mozilla.org/mozilla-central/rev/0022f8be9fea
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
You need to log in before you can comment on or make changes to this bug.