зеркало из https://github.com/mozilla/pjs.git
bug 569510 - check validity of mScaledFont before passing to cairo APIs. r=jdaggett a=blocking2.0
This commit is contained in:
Родитель
bf8c9e2ff5
Коммит
a291d927de
|
@ -260,7 +260,8 @@ gfxGDIFont::SetupCairoFont(gfxContext *aContext)
|
|||
if (!mMetrics) {
|
||||
Initialize();
|
||||
}
|
||||
if (cairo_scaled_font_status(mScaledFont) != CAIRO_STATUS_SUCCESS) {
|
||||
if (!mScaledFont ||
|
||||
cairo_scaled_font_status(mScaledFont) != CAIRO_STATUS_SUCCESS) {
|
||||
// Don't cairo_set_scaled_font as that would propagate the error to
|
||||
// the cairo_t, precluding any further drawing.
|
||||
return PR_FALSE;
|
||||
|
@ -423,12 +424,13 @@ gfxGDIFont::Initialize()
|
|||
&ctm, fontOptions);
|
||||
cairo_font_options_destroy(fontOptions);
|
||||
|
||||
cairo_status_t cairoerr = cairo_scaled_font_status(mScaledFont);
|
||||
if (cairoerr != CAIRO_STATUS_SUCCESS) {
|
||||
if (!mScaledFont ||
|
||||
cairo_scaled_font_status(mScaledFont) != CAIRO_STATUS_SUCCESS) {
|
||||
#ifdef DEBUG
|
||||
char warnBuf[1024];
|
||||
sprintf(warnBuf, "Failed to create scaled font: %s status: %d",
|
||||
NS_ConvertUTF16toUTF8(mFontEntry->Name()).get(), cairoerr);
|
||||
NS_ConvertUTF16toUTF8(mFontEntry->Name()).get(),
|
||||
mScaledFont ? cairo_scaled_font_status(mScaledFont) : 0);
|
||||
NS_WARNING(warnBuf);
|
||||
#endif
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче