Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1039)

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 1852433004: Fix NSPasteboard leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 430b23d96dd8d32e52d84ecc04a1c8c2b6708b4e..0046504addb82b4ccc1296d84b80ecf9a65f385c 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -21,6 +21,7 @@
#include "base/mac/scoped_cftyperef.h"
#import "base/mac/scoped_nsobject.h"
#include "base/mac/sdk_forward_declarations.h"
+#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/numerics/safe_conversions.h"
@@ -70,6 +71,7 @@
#include "third_party/WebKit/public/platform/WebScreenInfo.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#import "third_party/mozilla/ComplexTextInputPanel.h"
+#import "ui/base/clipboard/clipboard_util_mac.h"
#include "ui/base/cocoa/animation_utils.h"
#include "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/fullscreen_window_manager.h"
@@ -2425,11 +2427,11 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
renderWidgetHostView_->selected_text());
if ([text length] == 0)
return;
- NSPasteboard* pasteboard = [NSPasteboard pasteboardWithUniqueName];
+ scoped_refptr<ui::UniquePasteboard> pasteboard = new ui::UniquePasteboard;
NSArray* types = [NSArray arrayWithObject:NSStringPboardType];
- [pasteboard declareTypes:types owner:nil];
- if ([pasteboard setString:text forType:NSStringPboardType])
- NSPerformService(@"Look Up in Dictionary", pasteboard);
+ [pasteboard->get() declareTypes:types owner:nil];
+ if ([pasteboard->get() setString:text forType:NSStringPboardType])
+ NSPerformService(@"Look Up in Dictionary", pasteboard->get());
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
« no previous file with comments | « chrome/browser/ui/cocoa/find_pasteboard_unittest.mm ('k') | content/browser/web_contents/web_drag_dest_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698