From 745253a36943b613eb737b5bd85a2012dfbd4441 Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Mon, 1 Feb 2016 07:17:58 +0100 Subject: [PATCH] Quick fix for the memory leak + docs --- atom/browser/api/atom_api_web_contents.cc | 8 ++++---- atom/common/mouse_util.cc | 4 ++-- atom/common/mouse_util.h | 2 +- docs/api/web-contents.md | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index ba067da..b7b0576 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1043,13 +1043,13 @@ void WebContents::EndFrameSubscription() { } void WebContents::OnCursorChange(const content::WebCursor& cursor) { - content::WebCursor::CursorInfo* info = new content::WebCursor::CursorInfo(); - cursor.GetCursorInfo(info); + content::WebCursor::CursorInfo info; + cursor.GetCursorInfo(&info); if (cursor.IsCustom()) { Emit("cursor-changed", CursorTypeToString(info), - gfx::Image::CreateFrom1xBitmap(info->custom_image), - info->image_scale_factor); + gfx::Image::CreateFrom1xBitmap(info.custom_image), + info.image_scale_factor); } else { Emit("cursor-changed", CursorTypeToString(info)); } diff --git a/atom/common/mouse_util.cc b/atom/common/mouse_util.cc index 8b7e4bb..69aadaa 100644 --- a/atom/common/mouse_util.cc +++ b/atom/common/mouse_util.cc @@ -9,8 +9,8 @@ using Cursor = blink::WebCursorInfo::Type; namespace atom { -std::string CursorTypeToString(const content::WebCursor::CursorInfo* info) { - switch (info->type) { +std::string CursorTypeToString(const content::WebCursor::CursorInfo& info) { + switch (info.type) { case Cursor::TypePointer: return "default"; case Cursor::TypeCross: return "crosshair"; case Cursor::TypeHand: return "pointer"; diff --git a/atom/common/mouse_util.h b/atom/common/mouse_util.h index f754f9a..2fd9374 100644 --- a/atom/common/mouse_util.h +++ b/atom/common/mouse_util.h @@ -29,7 +29,7 @@ namespace atom { // Returns the cursor's type as a string. -std::string CursorTypeToString(const content::WebCursor::CursorInfo* info); +std::string CursorTypeToString(const content::WebCursor::CursorInfo& info); } // namespace atom diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 2dded8a..afdd08c 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -287,8 +287,8 @@ Returns: * `event` Event * `type` String -* `image` NativeImage -* `scale` Float +* `image` NativeImage (optional) +* `scale` Float (optional) Emitted when the cursor's type changes. The `type` parameter can be `default`, `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`, -- 2.7.4