Quick fix for the memory leak + docs
authorHeilig Benedek <benecene@gmail.com>
Mon, 1 Feb 2016 06:17:58 +0000 (07:17 +0100)
committerHeilig Benedek <benecene@gmail.com>
Mon, 1 Feb 2016 06:17:58 +0000 (07:17 +0100)
atom/browser/api/atom_api_web_contents.cc
atom/common/mouse_util.cc
atom/common/mouse_util.h
docs/api/web-contents.md

index ba067da..b7b0576 100644 (file)
@@ -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));
   }
index 8b7e4bb..69aadaa 100644 (file)
@@ -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";
index f754f9a..2fd9374 100644 (file)
@@ -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
 
index 2dded8a..afdd08c 100644 (file)
@@ -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`,