Skip to content

Commit

Permalink
Fix #7170: App crashes on Windows on call to Window.setBadgeLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerwang committed Oct 5, 2019
1 parent fc9b571 commit f27c5a0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/api/nw_window_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,9 @@ static base::win::ScopedHICON createBadgeIcon(const HWND hWnd, const TCHAR *valu
canvas.DrawCircle(gfx::Point(sizeX / 2, sizeY / 2), sizeX / 2, flags);

// drawing the text
gfx::PlatformFont *platform_font = gfx::PlatformFont::CreateDefault();
scoped_refptr<gfx::PlatformFont> platform_font(gfx::PlatformFont::CreateDefault());
const int fontSize = sizeY * 0.65f;
gfx::Font font(platform_font->GetFontName(), fontSize);
platform_font->Release();
platform_font = NULL;
const int yMargin = (sizeY - fontSize) / 2;
canvas.DrawStringRectWithFlags(value, gfx::FontList(font), SK_ColorWHITE, gfx::Rect(sizeX, fontSize + yMargin + 1), gfx::Canvas::TEXT_ALIGN_CENTER);

Expand Down

0 comments on commit f27c5a0

Please sign in to comment.