Closed Bug 714132 Opened 13 years ago Closed 13 years ago

Possible double release of a NSColor

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: hub, Assigned: hub)

Details

(Whiteboard: [inbound])

Attachments

(1 file)

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.
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+
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
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: