Closed
Bug 397209
Opened 17 years ago
Closed 17 years ago
Very wide <button> triggers Cocoa exception "Can't cache image"
Categories
(Core :: Widget: Cocoa, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jruderman, Assigned: cbarrett)
References
Details
(Keywords: testcase)
Attachments
(2 files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
jaas
:
review+
vlad
:
superreview+
vlad
:
approval1.9+
|
Details | Diff | Splinter Review |
Loading the testcase triggers:
2007-09-22 16:08:39.465 firefox-bin[7327] Can't cache image
Because of bug 163260 / bug 340453, this leads to various bad things happening, including bogus free() calls. It's possible that this won't be a problem once bug 163260 and bug 340453 are fixed.
Assignee | ||
Comment 1•17 years ago
|
||
In this case we need to put a try/catch around -[NSImage lockFocus]. It is documented to throw an exception if it cannot create a representation to draw in.
I wonder if we need to be doing offscreen drawing here -- perhaps we can adjust the CTM with a scale instead? Something to consider as we work on control drawing.
Assignee | ||
Comment 2•17 years ago
|
||
This was bothering me, so I fixed it.
There are two other places where we use lockFocus.
http://mxr.mozilla.org/seamonkey/source/widget/src/cocoa/nsDragService.mm#260
This one should get fixed in the same way as this bug, IMO.
http://mxr.mozilla.org/seamonkey/source/widget/src/cocoa/nsMenuItemIconX.mm#527
I don't understand why we're creating a CGImage and then drawing it into an NSImage. Can't we just create an NSBitmapImageRep instead?
Those are both separate bugs though.
Assignee | ||
Comment 3•17 years ago
|
||
And this one, too, which should also get fixed.
http://mxr.mozilla.org/seamonkey/source/modules/libpr0n/decoders/icon/mac/nsIconChannelCocoa.mm#299
Assignee | ||
Updated•17 years ago
|
Status: ASSIGNED → NEW
Comment 4•17 years ago
|
||
If this is trunk-only, should the newer @try/@catch stuff be used instead of the old-style NS_DURING, etc.?
Assignee | ||
Comment 5•17 years ago
|
||
Wevah, see bug 397381.
Attachment #282742 -
Flags: superreview?(vladimir)
Attachment #282742 -
Flags: review?(joshmoz)
Attachment #282742 -
Flags: review+
Comment 6•17 years ago
|
||
Ah, thanks.
Attachment #282742 -
Flags: superreview?(vladimir) → superreview+
Attachment #282742 -
Flags: approval1.9+
Assignee | ||
Comment 7•17 years ago
|
||
Checking in widget/src/cocoa/nsNativeThemeCocoa.mm;
/cvsroot/mozilla/widget/src/cocoa/nsNativeThemeCocoa.mm,v <-- nsNativeThemeCocoa.mm
new revision: 1.63; previous revision: 1.62
done
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 8•17 years ago
|
||
Now the testcase triggers
###!!! ASSERTION: Could not lock focus on offscreen buffer: '0', file /Users/jruderman/trunk/mozilla/widget/src/cocoa/nsNativeThemeCocoa.mm, line 195
which is better than a random crash later. I think it should be a warning rather than an assertion, though -- it's generally considered a bug if a page can trigger an assertion.
Assignee | ||
Comment 9•17 years ago
|
||
I changed this in my patch for bug 397381.
You need to log in
before you can comment on or make changes to this bug.
Description
•