Quick fix for the memory leak + docs

This commit is contained in:
Heilig Benedek 2016-02-01 07:17:58 +01:00
parent 066c189249
commit 745253a369
4 changed files with 9 additions and 9 deletions

View file

@ -1043,13 +1043,13 @@ void WebContents::EndFrameSubscription() {
} }
void WebContents::OnCursorChange(const content::WebCursor& cursor) { void WebContents::OnCursorChange(const content::WebCursor& cursor) {
content::WebCursor::CursorInfo* info = new content::WebCursor::CursorInfo(); content::WebCursor::CursorInfo info;
cursor.GetCursorInfo(info); cursor.GetCursorInfo(&info);
if (cursor.IsCustom()) { if (cursor.IsCustom()) {
Emit("cursor-changed", CursorTypeToString(info), Emit("cursor-changed", CursorTypeToString(info),
gfx::Image::CreateFrom1xBitmap(info->custom_image), gfx::Image::CreateFrom1xBitmap(info.custom_image),
info->image_scale_factor); info.image_scale_factor);
} else { } else {
Emit("cursor-changed", CursorTypeToString(info)); Emit("cursor-changed", CursorTypeToString(info));
} }

View file

@ -9,8 +9,8 @@ using Cursor = blink::WebCursorInfo::Type;
namespace atom { namespace atom {
std::string CursorTypeToString(const content::WebCursor::CursorInfo* info) { std::string CursorTypeToString(const content::WebCursor::CursorInfo& info) {
switch (info->type) { switch (info.type) {
case Cursor::TypePointer: return "default"; case Cursor::TypePointer: return "default";
case Cursor::TypeCross: return "crosshair"; case Cursor::TypeCross: return "crosshair";
case Cursor::TypeHand: return "pointer"; case Cursor::TypeHand: return "pointer";

View file

@ -29,7 +29,7 @@
namespace atom { namespace atom {
// Returns the cursor's type as a string. // 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 } // namespace atom

View file

@ -287,8 +287,8 @@ Returns:
* `event` Event * `event` Event
* `type` String * `type` String
* `image` NativeImage * `image` NativeImage (optional)
* `scale` Float * `scale` Float (optional)
Emitted when the cursor's type changes. The `type` parameter can be `default`, Emitted when the cursor's type changes. The `type` parameter can be `default`,
`crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`, `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,